Skip to content

Commit be0726c

Browse files
committed
Add revisions to safe/unsafe on unadorned extern blocks test
1 parent 1afc7d7 commit be0726c

3 files changed

+43
-2
lines changed

Diff for: tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.stderr renamed to tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.edition2021.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
error: items in unadorned `extern` blocks cannot have safety qualifiers
2-
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:2:5
2+
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:10:5
33
|
44
LL | extern "C" {
55
| ---------- help: add unsafe to this `extern` block
6+
LL |
67
LL | safe static TEST1: i32;
78
| ^^^^^^^^^^^^^^^^^^^^^^^
89

910
error: items in unadorned `extern` blocks cannot have safety qualifiers
10-
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:4:5
11+
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:12:5
1112
|
1213
LL | extern "C" {
1314
| ---------- help: add unsafe to this `extern` block
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
error: extern blocks must be unsafe
2+
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:8:1
3+
|
4+
LL | / extern "C" {
5+
LL | |
6+
LL | | safe static TEST1: i32;
7+
LL | |
8+
LL | | safe fn test1(i: i32);
9+
LL | |
10+
LL | | }
11+
| |_^
12+
13+
error: items in unadorned `extern` blocks cannot have safety qualifiers
14+
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:10:5
15+
|
16+
LL | extern "C" {
17+
| ---------- help: add unsafe to this `extern` block
18+
LL |
19+
LL | safe static TEST1: i32;
20+
| ^^^^^^^^^^^^^^^^^^^^^^^
21+
22+
error: items in unadorned `extern` blocks cannot have safety qualifiers
23+
--> $DIR/safe-unsafe-on-unadorned-extern-block.rs:12:5
24+
|
25+
LL | extern "C" {
26+
| ---------- help: add unsafe to this `extern` block
27+
...
28+
LL | safe fn test1(i: i32);
29+
| ^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error: aborting due to 3 previous errors
32+

Diff for: tests/ui/rust-2024/unsafe-extern-blocks/safe-unsafe-on-unadorned-extern-block.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
//@ revisions: edition2021 edition2024
2+
//@[edition2021] edition:2021
3+
//@[edition2024] edition:2024
4+
//@[edition2024] compile-flags: -Zunstable-options
5+
6+
#![feature(unsafe_extern_blocks)]
7+
18
extern "C" {
9+
//[edition2024]~^ ERROR extern blocks must be unsafe
210
safe static TEST1: i32;
311
//~^ ERROR items in unadorned `extern` blocks cannot have safety qualifiers
412
safe fn test1(i: i32);

0 commit comments

Comments
 (0)