rust icon indicating copy to clipboard operation
rust copied to clipboard

pub extern functions aren't considered unsafe from other crates

Open doy opened this issue 13 years ago • 3 comments

// 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.

doy avatar Apr 11 '13 19:04 doy

Still relevant. and I think this should require unsafe block. Nominating for milestone 1 (well-defined)

ILyoan avatar May 27 '13 10:05 ILyoan

Nominating for milestone 1 (well-defined)

jdm avatar May 27 '13 12:05 jdm

It appears that this was accepted for Maturity 1, well-defined.

bstrie avatar May 31 '13 20:05 bstrie