Add hard error for extern without explicit ABI
This commit is contained in:
@@ -684,7 +684,7 @@ impl<'a> AstValidator<'a> {
|
||||
self.dcx().emit_err(errors::PatternFnPointer { span });
|
||||
});
|
||||
if let Extern::Implicit(extern_span) = bfty.ext {
|
||||
self.maybe_lint_missing_abi(extern_span, ty.id);
|
||||
self.handle_missing_abi(extern_span, ty.id);
|
||||
}
|
||||
}
|
||||
TyKind::TraitObject(bounds, ..) => {
|
||||
@@ -717,10 +717,12 @@ impl<'a> AstValidator<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn maybe_lint_missing_abi(&mut self, span: Span, id: NodeId) {
|
||||
fn handle_missing_abi(&mut self, span: Span, id: NodeId) {
|
||||
// FIXME(davidtwco): This is a hack to detect macros which produce spans of the
|
||||
// call site which do not have a macro backtrace. See #61963.
|
||||
if self
|
||||
if span.edition().at_least_edition_future() && self.features.explicit_extern_abis() {
|
||||
self.dcx().emit_err(errors::MissingAbi { span });
|
||||
} else if self
|
||||
.sess
|
||||
.source_map()
|
||||
.span_to_snippet(span)
|
||||
@@ -996,7 +998,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
}
|
||||
|
||||
if abi.is_none() {
|
||||
self.maybe_lint_missing_abi(*extern_span, item.id);
|
||||
self.handle_missing_abi(*extern_span, item.id);
|
||||
}
|
||||
self.with_in_extern_mod(*safety, |this| {
|
||||
visit::walk_item(this, item);
|
||||
@@ -1370,7 +1372,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
},
|
||||
) = fk
|
||||
{
|
||||
self.maybe_lint_missing_abi(*extern_span, id);
|
||||
self.handle_missing_abi(*extern_span, id);
|
||||
}
|
||||
|
||||
// Functions without bodies cannot have patterns.
|
||||
|
||||
Reference in New Issue
Block a user