This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed
tests/ui/rust-2024/unsafe-extern-blocks Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 11error: 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 |
44LL | extern "C" {
55 | ---------- help: add unsafe to this `extern` block
6+ LL |
67LL | safe static TEST1: i32;
78 | ^^^^^^^^^^^^^^^^^^^^^^^
89
910error: 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 |
1213LL | extern "C" {
1314 | ---------- help: add unsafe to this `extern` block
Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 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+
18extern "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 ) ;
You can’t perform that action at this time.
0 commit comments