Skip to content

Commit 971d306

Browse files
committed
test: test that the unsafe_block lint picks up unsafe blocks in
macros.
1 parent 1dea21f commit 971d306

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/compile-fail/lint-unsafe-block.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,20 @@
1010

1111
#[allow(unused_unsafe)];
1212
#[deny(unsafe_block)];
13+
#[feature(macro_rules)];
1314

1415
unsafe fn allowed() {}
1516

1617
#[allow(unsafe_block)] fn also_allowed() { unsafe {} }
1718

19+
macro_rules! unsafe_in_macro {
20+
() => {
21+
unsafe {} //~ ERROR: usage of an `unsafe` block
22+
}
23+
}
24+
1825
fn main() {
1926
unsafe {} //~ ERROR: usage of an `unsafe` block
27+
28+
unsafe_in_macro!()
2029
}

0 commit comments

Comments
 (0)