Skip to content

Commit

Permalink
Test that safe items fail even with feature(unsafe_extern_blocks)
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jun 20, 2024
1 parent 7e0bdb2 commit 8cef2ba
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/ui/rust-2024/safe-outside-extern-with-feature.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(unsafe_extern_blocks)]

safe fn foo() {}
//~^ ERROR: items cannot be declared with `safe` safety qualifier

safe static FOO: i32 = 1;
//~^ ERROR: items cannot be declared with `safe` safety qualifier

fn main() {}
14 changes: 14 additions & 0 deletions tests/ui/rust-2024/safe-outside-extern-with-feature.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: items cannot be declared with `safe` safety qualifier
--> $DIR/safe-outside-extern-with-feature.rs:3:1
|
LL | safe fn foo() {}
| ^^^^^^^^^^^^^^^^

error: items cannot be declared with `safe` safety qualifier
--> $DIR/safe-outside-extern-with-feature.rs:6:1
|
LL | safe static FOO: i32 = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

0 comments on commit 8cef2ba

Please sign in to comment.