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