Skip to content

Commit efd111e

Browse files
committed
Add test
1 parent 60a68be commit efd111e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#![forbid(unsafe_code)]
2+
#![feature(allow_internal_unsafe)]
3+
4+
#[allow_internal_unsafe]
5+
//~^ ERROR: cannot use `allow_internal_unsafe` with `forbid(unsafe_code)`
6+
macro_rules! evil {
7+
($e:expr) => {
8+
unsafe {
9+
$e
10+
}
11+
}
12+
}
13+
14+
fn main() {
15+
println!("{}", evil!(*(0 as *const u8)));
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: cannot use `allow_internal_unsafe` with `forbid(unsafe_code)`
2+
--> $DIR/lint-forbid-internal-unsafe.rs:4:1
3+
|
4+
LL | #[allow_internal_unsafe]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: lint level defined here
8+
--> $DIR/lint-forbid-internal-unsafe.rs:1:11
9+
|
10+
LL | #![forbid(unsafe_code)]
11+
| ^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)