File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
compiler/rustc_ast_passes Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ ast_passes_extern_types_cannot = `type`s inside `extern` blocks cannot have {$de
79
79
.suggestion = remove the { $remove_descr }
80
80
.label = `extern` block begins here
81
81
82
+ ast_passes_extern_without_abi = extern declaration without an ABI
83
+ .label = ABI should be specified here
84
+ .suggestion = explicitly specify an ABI
85
+
82
86
ast_passes_feature_on_non_nightly = `#![feature]` may not be used on the { $channel } release channel
83
87
.suggestion = remove the attribute
84
88
.stable_since = the feature `{ $name } ` has been stable since `{ $since } ` and no longer requires an attribute to enable
Original file line number Diff line number Diff line change @@ -712,6 +712,10 @@ impl<'a> AstValidator<'a> {
712
712
}
713
713
714
714
fn maybe_lint_missing_abi ( & mut self , span : Span , id : NodeId ) {
715
+ if span. edition ( ) . at_least_rust_2024 ( ) {
716
+ self . dcx ( )
717
+ . emit_err ( errors:: MissingAbi { span, default_abi : abi:: Abi :: FALLBACK . name ( ) } ) ;
718
+ }
715
719
// FIXME(davidtwco): This is a hack to detect macros which produce spans of the
716
720
// call site which do not have a macro backtrace. See #61963.
717
721
if self
Original file line number Diff line number Diff line change @@ -833,3 +833,12 @@ pub(crate) struct DuplicatePreciseCapturing {
833
833
#[ label]
834
834
pub bound2 : Span ,
835
835
}
836
+
837
+ #[ derive( Diagnostic ) ]
838
+ #[ diag( ast_passes_extern_without_abi) ]
839
+ pub ( crate ) struct MissingAbi {
840
+ #[ primary_span]
841
+ #[ suggestion( code = "extern \" {default_abi}\" " , applicability = "machine-applicable" ) ]
842
+ pub span : Span ,
843
+ pub default_abi : & ' static str ,
844
+ }
You can’t perform that action at this time.
0 commit comments