rust/tests/ui/lint/lint-forbid-internal-unsafe.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
333 B
Rust
Raw Normal View History

2019-01-14 21:55:17 +00:00
#![forbid(unsafe_code)]
#![feature(allow_internal_unsafe)]
#[allow_internal_unsafe]
2019-01-15 09:02:46 +00:00
//~^ ERROR: `allow_internal_unsafe` allows defining
2019-01-14 21:55:17 +00:00
macro_rules! evil {
($e:expr) => {
unsafe {
$e
}
}
}
fn main() {
println!("{}", evil!(*(0 as *const u8)));
//~^ WARNING dereferencing a null pointer
2019-01-14 21:55:17 +00:00
}