interpret errors: add map_err_kind, rename InterpError -> InterpErrorKind
This commit is contained in:
@@ -11,7 +11,8 @@ use rustc_span::{Span, Symbol};
|
||||
use super::CompileTimeMachine;
|
||||
use crate::errors::{self, FrameNote, ReportErrorExt};
|
||||
use crate::interpret::{
|
||||
ErrorHandled, Frame, InterpError, InterpErrorInfo, MachineStopType, err_inval, err_machine_stop,
|
||||
ErrorHandled, Frame, InterpErrorInfo, InterpErrorKind, MachineStopType, err_inval,
|
||||
err_machine_stop,
|
||||
};
|
||||
|
||||
/// The CTFE machine has some custom error kinds.
|
||||
@@ -57,7 +58,7 @@ impl MachineStopType for ConstEvalErrKind {
|
||||
}
|
||||
}
|
||||
|
||||
/// The errors become [`InterpError::MachineStop`] when being raised.
|
||||
/// The errors become [`InterpErrorKind::MachineStop`] when being raised.
|
||||
impl<'tcx> Into<InterpErrorInfo<'tcx>> for ConstEvalErrKind {
|
||||
fn into(self) -> InterpErrorInfo<'tcx> {
|
||||
err_machine_stop!(self).into()
|
||||
@@ -124,7 +125,7 @@ pub fn get_span_and_frames<'tcx>(
|
||||
/// `get_span_and_frames`.
|
||||
pub(super) fn report<'tcx, C, F, E>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
error: InterpError<'tcx>,
|
||||
error: InterpErrorKind<'tcx>,
|
||||
span: Span,
|
||||
get_span_and_frames: C,
|
||||
mk: F,
|
||||
|
||||
@@ -18,7 +18,7 @@ use tracing::{debug, instrument, trace};
|
||||
use super::{CanAccessMutGlobal, CompileTimeInterpCx, CompileTimeMachine};
|
||||
use crate::const_eval::CheckAlignment;
|
||||
use crate::interpret::{
|
||||
CtfeValidationMode, GlobalId, Immediate, InternKind, InternResult, InterpCx, InterpError,
|
||||
CtfeValidationMode, GlobalId, Immediate, InternKind, InternResult, InterpCx, InterpErrorKind,
|
||||
InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking, StackPopCleanup, create_static_alloc,
|
||||
eval_nullary_intrinsic, intern_const_alloc_recursive, interp_ok, throw_exhaust,
|
||||
};
|
||||
@@ -463,7 +463,7 @@ fn report_validation_error<'tcx>(
|
||||
error: InterpErrorInfo<'tcx>,
|
||||
alloc_id: AllocId,
|
||||
) -> ErrorHandled {
|
||||
if !matches!(error.kind(), InterpError::UndefinedBehavior(_)) {
|
||||
if !matches!(error.kind(), InterpErrorKind::UndefinedBehavior(_)) {
|
||||
// Some other error happened during validation, e.g. an unsupported operation.
|
||||
return report_eval_error(ecx, cid, error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user