File tree 4 files changed +21
-1
lines changed
compiler/rustc_ast_passes/src
4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1088,7 +1088,15 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
1088
1088
}
1089
1089
}
1090
1090
} else if let & Safety :: Unsafe ( span) = safety {
1091
- this. dcx ( ) . emit_err ( errors:: UnsafeItem { span, kind : "extern block" } ) ;
1091
+ let mut diag = this
1092
+ . dcx ( )
1093
+ . create_err ( errors:: UnsafeItem { span, kind : "extern block" } ) ;
1094
+ rustc_session:: parse:: add_feature_diagnostics (
1095
+ & mut diag,
1096
+ self . session ,
1097
+ sym:: unsafe_extern_blocks,
1098
+ ) ;
1099
+ diag. emit ( ) ;
1092
1100
}
1093
1101
1094
1102
if abi. is_none ( ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ error: extern block cannot be declared unsafe
3
3
|
4
4
LL | unsafe extern "C" {
5
5
| ^^^^^^
6
+ |
7
+ = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
8
+ = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable
9
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6
10
7
11
error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental
8
12
--> $DIR/feature-gate-unsafe-extern-blocks.rs:9:5
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ error: extern block cannot be declared unsafe
9
9
|
10
10
LL | extern "C" unsafe {
11
11
| ^^^^^^
12
+ |
13
+ = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
14
+ = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable
15
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
12
16
13
17
error: items in unadorned `extern` blocks cannot have safety qualifiers
14
18
--> $DIR/unsafe-foreign-mod-2.rs:4:5
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ error: extern block cannot be declared unsafe
3
3
|
4
4
LL | unsafe extern "C" {
5
5
| ^^^^^^
6
+ |
7
+ = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
8
+ = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable
9
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6
10
7
11
error: aborting due to 1 previous error
8
12
You can’t perform that action at this time.
0 commit comments