This commit is contained in:
Yuki Okushi 2019-01-15 06:55:17 +09:00
parent 60a68bed7b
commit efd111e502
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#![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)));
}

View File

@ -0,0 +1,14 @@
error: cannot use `allow_internal_unsafe` with `forbid(unsafe_code)`
--> $DIR/lint-forbid-internal-unsafe.rs:4:1
|
LL | #[allow_internal_unsafe]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-forbid-internal-unsafe.rs:1:11
|
LL | #![forbid(unsafe_code)]
| ^^^^^^^^^^^
error: aborting due to previous error