]> git.lizzy.rs Git - rust.git/commitdiff
code review fixes
authorSaleem Jaffer <ssaleem1992@gmail.com>
Thu, 1 Aug 2019 06:43:49 +0000 (12:13 +0530)
committerSaleem Jaffer <ssaleem1992@gmail.com>
Thu, 1 Aug 2019 06:43:49 +0000 (12:13 +0530)
src/librustc/mir/interpret/mod.rs
src/librustc_mir/transform/const_prop.rs

index f3ed4ffab7d0fc0a9846a58ac083bdb6479ca41d..723a30792fddc0f7a7d0c3ac00ffdd8e5d324b47 100644 (file)
@@ -57,11 +57,7 @@ macro_rules! throw_inval {
 
 #[macro_export]
 macro_rules! throw_ub {
-    ($($tt:tt)*) => {
-        return Err($crate::mir::interpret::InterpError::UndefinedBehaviour(
-            $crate::mir::interpret::UndefinedBehaviourInfo::$($tt)*
-        ).into())
-    };
+    ($($tt:tt)*) => { return Err(err_ub!($($tt)*).into()) };
 }
 
 #[macro_export]
index 5783f53316c57580e61a9e08ebaa1aba47d4a54d..a450ec32e1a478410a432d9c971c7d9b32f6dbab 100644 (file)
@@ -259,6 +259,12 @@ fn use_ecx<F, T>(
                 use rustc::mir::interpret::InterpError::*;
                 match diagnostic.error {
                     Exit(_) => bug!("the CTFE program cannot exit"),
+                    Unsupported(_)
+                    | UndefinedBehaviour(_)
+                    | InvalidProgram(_)
+                    | ResourceExhaustion(_) => {
+                        // Ignore these errors.
+                    }
                     Panic(_) => {
                         diagnostic.report_as_lint(
                             self.ecx.tcx,
@@ -267,7 +273,6 @@ fn use_ecx<F, T>(
                             None,
                         );
                     }
-                    _ => {},
                 }
                 None
             },