forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#127535 - spastorino:unsafe_code-unsafe_extern_blocks, r=oli-obk Fire unsafe_code lint on unsafe extern blocks Fixes rust-lang#126738
- Loading branch information
Showing
5 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|