diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2024-06-04 14:44:57 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2024-06-05 09:36:01 -0300 |
| commit | be0726c7c152700a47d91a27a4817c0af770e8e9 (patch) | |
| tree | da99cb52370bbdc92b76f058bbceebdb132a0570 | |
| parent | 1afc7d716cfb7858863754217566b785bac179a4 (diff) | |
| download | rust-be0726c7c152700a47d91a27a4817c0af770e8e9.tar.gz rust-be0726c7c152700a47d91a27a4817c0af770e8e9.zip | |
Add revisions to safe/unsafe on unadorned extern blocks test
| -rw-r--r-- | tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2021.stderr (renamed from tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.stderr) | 5 | ||||
| -rw-r--r-- | tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2024.stderr | 32 | ||||
| -rw-r--r-- | tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.rs | 8 |
3 files changed, 43 insertions, 2 deletions
diff --git a/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.stderr b/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2021.stderr index 66624f1fcb1..411cf48b486 100644 --- a/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.stderr +++ b/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2021.stderr @@ -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 diff --git a/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2024.stderr b/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2024.stderr new file mode 100644 index 00000000000..b634adc2999 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2024.stderr @@ -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 + diff --git a/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.rs b/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.rs index d37a7be452d..11f55cb195f 100644 --- a/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.rs +++ b/tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.rs @@ -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); |
