test: test that the unsafe_block lint picks up unsafe blocks in
macros.
This commit is contained in:
parent
1dea21f41d
commit
971d306fe2
1 changed files with 9 additions and 0 deletions
|
|
@ -10,11 +10,20 @@
|
|||
|
||||
#[allow(unused_unsafe)];
|
||||
#[deny(unsafe_block)];
|
||||
#[feature(macro_rules)];
|
||||
|
||||
unsafe fn allowed() {}
|
||||
|
||||
#[allow(unsafe_block)] fn also_allowed() { unsafe {} }
|
||||
|
||||
macro_rules! unsafe_in_macro {
|
||||
() => {
|
||||
unsafe {} //~ ERROR: usage of an `unsafe` block
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {} //~ ERROR: usage of an `unsafe` block
|
||||
|
||||
unsafe_in_macro!()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue