Fire unsafe_code lint on unsafe extern blocks
This commit is contained in:
parent
c3774be741
commit
a3ef94e80e
5 changed files with 41 additions and 0 deletions
14
tests/ui/lint/unsafe_code/unsafe-extern-blocks.rs
Normal file
14
tests/ui/lint/unsafe_code/unsafe-extern-blocks.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#![feature(unsafe_extern_blocks)]
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe extern "C" {
|
||||
fn foo();
|
||||
}
|
||||
|
||||
unsafe extern "C" {
|
||||
//~^ ERROR usage of an `unsafe extern` block [unsafe_code]
|
||||
fn bar();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
17
tests/ui/lint/unsafe_code/unsafe-extern-blocks.stderr
Normal file
17
tests/ui/lint/unsafe_code/unsafe-extern-blocks.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error: usage of an `unsafe extern` block
|
||||
--> $DIR/unsafe-extern-blocks.rs:9:1
|
||||
|
|
||||
LL | / unsafe extern "C" {
|
||||
LL | |
|
||||
LL | | fn bar();
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unsafe-extern-blocks.rs:2:9
|
||||
|
|
||||
LL | #![deny(unsafe_code)]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue