rust
rust copied to clipboard
pub extern functions aren't considered unsafe from other crates
// crate.rs
#[crate_type = "lib"];
pub extern "C" {
fn rand() -> libc::c_int;
}
// test.rs
extern mod crate;
fn main () {
println(fmt!("%?", crate::rand()));
}
Compiling these as separate crates doesn't produce an error, but compiling them both as part of the same crate does, as does compiling a crate which uses a function from a different crate which was explicitly marked as unsafe. It seems like this should be consistent.
Still relevant. and I think this should require unsafe block. Nominating for milestone 1 (well-defined)
Nominating for milestone 1 (well-defined)
It appears that this was accepted for Maturity 1, well-defined.