From 89a370db0f6caef02b34cd42a151ef21613a8b44 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 3 Aug 2019 20:36:05 +0200 Subject: [PATCH] add variant for experimental UB (like Stacked Borrows) --- src/librustc/mir/interpret/error.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 6a8cd9b46ae..5d60108f37c 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -342,8 +342,10 @@ impl fmt::Debug for InvalidProgramInfo<'tcx> { #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub enum UndefinedBehaviorInfo { - /// Handle cases which for which we do not have a fixed variant. + /// Free-form case. Only for errors that are never caught! Ub(String), + /// Free-form case for experimental UB. Only for errors that are never caught! + UbExperimental(String), /// Unreachable code was executed. Unreachable, } @@ -352,7 +354,7 @@ impl fmt::Debug for UndefinedBehaviorInfo { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use UndefinedBehaviorInfo::*; match self { - Ub(ref msg) => + Ub(msg) | UbExperimental(msg) => write!(f, "{}", msg), Unreachable => write!(f, "entered unreachable code"), @@ -362,7 +364,7 @@ impl fmt::Debug for UndefinedBehaviorInfo { #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub enum UnsupportedOpInfo<'tcx> { - /// Handle cases which for which we do not have a fixed variant. + /// Free-form case. Only for errors that are never caught! Unsupported(String), // -- Everything below is not classified yet --