Skip to content

Commit a9b1dcf

Browse files
committed
auto merge of #10606 : huonw/rust/lint-unsafe-in-macro, r=thestinger
Add a test for the case I mentioned on #10599.
2 parents 8d87e9d + 971d306 commit a9b1dcf

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)