rust/src/test/ui/lint/lint-forbid-internal-unsafe.rs

17 lines
309 B
Rust
Raw Normal View History

2019-01-14 15:55:17 -06:00
#![forbid(unsafe_code)]
#![feature(allow_internal_unsafe)]
#[allow_internal_unsafe]
//~^ ERROR: cannot use `allow_internal_unsafe` with `forbid(unsafe_code)`
macro_rules! evil {
($e:expr) => {
unsafe {
$e
}
}
}
fn main() {
println!("{}", evil!(*(0 as *const u8)));
}