1
Fork 0

Rollup merge of #136833 - workingjubilee:let-the-impossible-be-impossible, r=compiler-errors

compiler: die immediately instead of handling unknown target codegen

We cannot produce anything useful if asked to compile unknown targets. We should handle the error immediately at the point of discovery instead of propagating it upward, and preferably in the simplest way: Die.

This allows cleaning up our "error-handling" spread across 5 crates.
This commit is contained in:
Matthias Krüger 2025-02-11 18:04:44 +01:00 committed by GitHub
commit 8ade6baa12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 8 additions and 64 deletions

View file

@ -16,7 +16,6 @@ use rustc_middle::mir::interpret::{
};
use rustc_middle::ty::{self, Mutability, Ty};
use rustc_span::{Span, Symbol};
use rustc_target::callconv::AdjustForForeignAbiError;
use crate::interpret::InternKind;
@ -936,9 +935,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
InvalidProgramInfo::TooGeneric => const_eval_too_generic,
InvalidProgramInfo::AlreadyReported(_) => const_eval_already_reported,
InvalidProgramInfo::Layout(e) => e.diagnostic_message(),
InvalidProgramInfo::FnAbiAdjustForForeignAbi(_) => {
rustc_middle::error::middle_adjust_for_foreign_abi_error
}
}
}
fn add_args<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
@ -953,12 +949,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
}
dummy_diag.cancel();
}
InvalidProgramInfo::FnAbiAdjustForForeignAbi(
AdjustForForeignAbiError::Unsupported { arch, abi },
) => {
diag.arg("arch", arch);
diag.arg("abi", abi.name());
}
}
}
}

View file

@ -106,9 +106,6 @@ impl<'tcx, M: Machine<'tcx>> FnAbiOfHelpers<'tcx> for InterpCx<'tcx, M> {
) -> InterpErrorKind<'tcx> {
match err {
FnAbiError::Layout(err) => err_inval!(Layout(err)),
FnAbiError::AdjustForForeignAbi(err) => {
err_inval!(FnAbiAdjustForForeignAbi(err))
}
}
}
}