Add revisions to safe/unsafe on unadorned extern blocks test

This commit is contained in:
Santiago Pastorino 2024-06-04 14:44:57 -03:00
parent 1afc7d716c
commit be0726c7c1
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
3 changed files with 43 additions and 2 deletions

View File

@ -1,13 +1,14 @@
error: items in unadorned `extern` blocks cannot have safety qualifiers
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:2:5
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:10:5
|
LL | extern "C" {
| ---------- help: add unsafe to this `extern` block
LL |
LL | safe static TEST1: i32;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: items in unadorned `extern` blocks cannot have safety qualifiers
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:4:5
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:12:5
|
LL | extern "C" {
| ---------- help: add unsafe to this `extern` block

View File

@ -0,0 +1,32 @@
error: extern blocks must be unsafe
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:8:1
|
LL | / extern "C" {
LL | |
LL | | safe static TEST1: i32;
LL | |
LL | | safe fn test1(i: i32);
LL | |
LL | | }
| |_^
error: items in unadorned `extern` blocks cannot have safety qualifiers
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:10:5
|
LL | extern "C" {
| ---------- help: add unsafe to this `extern` block
LL |
LL | safe static TEST1: i32;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: items in unadorned `extern` blocks cannot have safety qualifiers
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:12:5
|
LL | extern "C" {
| ---------- help: add unsafe to this `extern` block
...
LL | safe fn test1(i: i32);
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -1,4 +1,12 @@
//@ revisions: edition2021 edition2024
//@[edition2021] edition:2021
//@[edition2024] edition:2024
//@[edition2024] compile-flags: -Zunstable-options
#![feature(unsafe_extern_blocks)]
extern "C" {
//[edition2024]~^ ERROR extern blocks must be unsafe
safe static TEST1: i32;
//~^ ERROR items in unadorned `extern` blocks cannot have safety qualifiers
safe fn test1(i: i32);