hir_analysis: Avoid repeating unsupported ABI errors

This commit is contained in:
Jubilee Young
2025-06-13 12:47:29 -07:00
parent 2f4a55b41d
commit e93a99b324

View File

@@ -58,15 +58,9 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi
match AbiMap::from_target(&tcx.sess.target).canonize_abi(abi, false) {
AbiMapping::Direct(..) => (),
// already erred in rustc_ast_lowering
AbiMapping::Invalid => {
let mut err = struct_span_code_err!(
tcx.dcx(),
span,
E0570,
"`{abi}` is not a supported ABI for the current target",
);
add_abi_diag_help(abi, &mut err);
err.emit();
tcx.dcx().span_delayed_bug(span, format!("{abi} should be rejected in ast_lowering"));
}
AbiMapping::Deprecated(..) => {
tcx.node_span_lint(UNSUPPORTED_CALLING_CONVENTIONS, hir_id, span, |lint| {