1
Fork 0

be less British

This commit is contained in:
Ralf Jung 2019-08-02 23:24:27 +02:00
parent cf048cc115
commit 1b132a2f41
3 changed files with 9 additions and 9 deletions

View file

@ -341,16 +341,16 @@ impl fmt::Debug for InvalidProgramInfo<'tcx> {
} }
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
pub enum UndefinedBehaviourInfo { pub enum UndefinedBehaviorInfo {
/// Handle cases which for which we do not have a fixed variant. /// Handle cases which for which we do not have a fixed variant.
Ub(String), Ub(String),
/// Unreachable code was executed. /// Unreachable code was executed.
Unreachable, Unreachable,
} }
impl fmt::Debug for UndefinedBehaviourInfo { impl fmt::Debug for UndefinedBehaviorInfo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use UndefinedBehaviourInfo::*; use UndefinedBehaviorInfo::*;
match self { match self {
Ub(ref msg) => Ub(ref msg) =>
write!(f, "{}", msg), write!(f, "{}", msg),
@ -572,7 +572,7 @@ pub enum InterpError<'tcx> {
/// The program panicked. /// The program panicked.
Panic(PanicInfo<u64>), Panic(PanicInfo<u64>),
/// The program caused undefined behavior. /// The program caused undefined behavior.
UndefinedBehaviour(UndefinedBehaviourInfo), UndefinedBehavior(UndefinedBehaviorInfo),
/// The program did something the interpreter does not support (some of these *might* be UB /// The program did something the interpreter does not support (some of these *might* be UB
/// but the interpreter is not sure). /// but the interpreter is not sure).
Unsupported(UnsupportedOpInfo<'tcx>), Unsupported(UnsupportedOpInfo<'tcx>),
@ -603,7 +603,7 @@ impl fmt::Debug for InterpError<'_> {
write!(f, "{:?}", msg), write!(f, "{:?}", msg),
InvalidProgram(ref msg) => InvalidProgram(ref msg) =>
write!(f, "{:?}", msg), write!(f, "{:?}", msg),
UndefinedBehaviour(ref msg) => UndefinedBehavior(ref msg) =>
write!(f, "{:?}", msg), write!(f, "{:?}", msg),
ResourceExhaustion(ref msg) => ResourceExhaustion(ref msg) =>
write!(f, "{:?}", msg), write!(f, "{:?}", msg),

View file

@ -21,8 +21,8 @@ macro_rules! err_inval {
#[macro_export] #[macro_export]
macro_rules! err_ub { macro_rules! err_ub {
($($tt:tt)*) => { ($($tt:tt)*) => {
$crate::mir::interpret::InterpError::UndefinedBehaviour( $crate::mir::interpret::InterpError::UndefinedBehavior(
$crate::mir::interpret::UndefinedBehaviourInfo::$($tt)* $crate::mir::interpret::UndefinedBehaviorInfo::$($tt)*
) )
}; };
} }
@ -78,7 +78,7 @@ mod pointer;
pub use self::error::{ pub use self::error::{
InterpErrorInfo, InterpResult, InterpError, AssertMessage, ConstEvalErr, struct_error, InterpErrorInfo, InterpResult, InterpError, AssertMessage, ConstEvalErr, struct_error,
FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled, PanicInfo, UnsupportedOpInfo, FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled, PanicInfo, UnsupportedOpInfo,
InvalidProgramInfo, ResourceExhaustionInfo, UndefinedBehaviourInfo, InvalidProgramInfo, ResourceExhaustionInfo, UndefinedBehaviorInfo,
}; };
pub use self::value::{Scalar, ScalarMaybeUndef, RawConst, ConstValue}; pub use self::value::{Scalar, ScalarMaybeUndef, RawConst, ConstValue};

View file

@ -260,7 +260,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
match diagnostic.error { match diagnostic.error {
Exit(_) => bug!("the CTFE program cannot exit"), Exit(_) => bug!("the CTFE program cannot exit"),
Unsupported(_) Unsupported(_)
| UndefinedBehaviour(_) | UndefinedBehavior(_)
| InvalidProgram(_) | InvalidProgram(_)
| ResourceExhaustion(_) => { | ResourceExhaustion(_) => {
// Ignore these errors. // Ignore these errors.