]> git.lizzy.rs Git - rust.git/commitdiff
Assert that promoteds don't fail to be evaluated for being too generic
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 29 Oct 2018 13:50:30 +0000 (14:50 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 29 Oct 2018 13:50:30 +0000 (14:50 +0100)
src/librustc_mir/const_eval.rs

index 7db9c3f110272cd34982044c596f94825be524bb..38ab21b7c8c85bcf5728b46f2dc4ec4ab19162d8 100644 (file)
@@ -576,7 +576,11 @@ pub fn const_eval_provider<'a, 'tcx>(
         key.param_env.reveal = Reveal::UserFacing;
         match tcx.const_eval(key) {
             // try again with reveal all as requested
-            Err(ErrorHandled::TooGeneric) => {},
+            Err(ErrorHandled::TooGeneric) => {
+                // Promoteds should never be "too generic" when getting evaluated.
+                // They either don't get evaluated, or we are in a monomorphic context
+                assert!(key.value.promoted.is_none());
+            },
             // dedupliate calls
             other => return other,
         }