File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
compiler/rustc_ast_passes/src Expand file tree Collapse file tree 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> {
10881088 }
10891089 }
10901090 } 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 ( ) ;
10921100 }
10931101
10941102 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
33 |
44LL | unsafe extern "C" {
55 | ^^^^^^
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
610
711error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental
812 --> $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
99 |
1010LL | extern "C" unsafe {
1111 | ^^^^^^
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
1216
1317error: items in unadorned `extern` blocks cannot have safety qualifiers
1418 --> $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
33 |
44LL | unsafe extern "C" {
55 | ^^^^^^
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
610
711error: aborting due to 1 previous error
812
You can’t perform that action at this time.
0 commit comments