interpret errors: add map_err_kind, rename InterpError -> InterpErrorKind
This commit is contained in:
parent
b27f33a4d9
commit
eea74be5c1
17 changed files with 108 additions and 95 deletions
|
@ -9,7 +9,7 @@ use rustc_errors::{
|
|||
use rustc_hir::ConstContext;
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::mir::interpret::{
|
||||
CheckInAllocMsg, CtfeProvenance, ExpectedKind, InterpError, InvalidMetaKind,
|
||||
CheckInAllocMsg, CtfeProvenance, ExpectedKind, InterpErrorKind, InvalidMetaKind,
|
||||
InvalidProgramInfo, Misalignment, Pointer, PointerKind, ResourceExhaustionInfo,
|
||||
UndefinedBehaviorInfo, UnsupportedOpInfo, ValidationErrorInfo,
|
||||
};
|
||||
|
@ -835,23 +835,23 @@ impl ReportErrorExt for UnsupportedOpInfo {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ReportErrorExt for InterpError<'tcx> {
|
||||
impl<'tcx> ReportErrorExt for InterpErrorKind<'tcx> {
|
||||
fn diagnostic_message(&self) -> DiagMessage {
|
||||
match self {
|
||||
InterpError::UndefinedBehavior(ub) => ub.diagnostic_message(),
|
||||
InterpError::Unsupported(e) => e.diagnostic_message(),
|
||||
InterpError::InvalidProgram(e) => e.diagnostic_message(),
|
||||
InterpError::ResourceExhaustion(e) => e.diagnostic_message(),
|
||||
InterpError::MachineStop(e) => e.diagnostic_message(),
|
||||
InterpErrorKind::UndefinedBehavior(ub) => ub.diagnostic_message(),
|
||||
InterpErrorKind::Unsupported(e) => e.diagnostic_message(),
|
||||
InterpErrorKind::InvalidProgram(e) => e.diagnostic_message(),
|
||||
InterpErrorKind::ResourceExhaustion(e) => e.diagnostic_message(),
|
||||
InterpErrorKind::MachineStop(e) => e.diagnostic_message(),
|
||||
}
|
||||
}
|
||||
fn add_args<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
|
||||
match self {
|
||||
InterpError::UndefinedBehavior(ub) => ub.add_args(diag),
|
||||
InterpError::Unsupported(e) => e.add_args(diag),
|
||||
InterpError::InvalidProgram(e) => e.add_args(diag),
|
||||
InterpError::ResourceExhaustion(e) => e.add_args(diag),
|
||||
InterpError::MachineStop(e) => e.add_args(&mut |name, value| {
|
||||
InterpErrorKind::UndefinedBehavior(ub) => ub.add_args(diag),
|
||||
InterpErrorKind::Unsupported(e) => e.add_args(diag),
|
||||
InterpErrorKind::InvalidProgram(e) => e.add_args(diag),
|
||||
InterpErrorKind::ResourceExhaustion(e) => e.add_args(diag),
|
||||
InterpErrorKind::MachineStop(e) => e.add_args(&mut |name, value| {
|
||||
diag.arg(name, value);
|
||||
}),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue