about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-10-29 14:50:30 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-10-29 14:50:30 +0100
commite0106d99d699bbb427f4ebb156a343cc26159e11 (patch)
treec1bd9dcdaa952fe61ab68dc53403ebadcdebb3b4
parent4e88b7363b7858960ccfd87326ece9d00bf4d973 (diff)
downloadrust-e0106d99d699bbb427f4ebb156a343cc26159e11.tar.gz
rust-e0106d99d699bbb427f4ebb156a343cc26159e11.zip
Assert that promoteds don't fail to be evaluated for being too generic
-rw-r--r--src/librustc_mir/const_eval.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs
index 7db9c3f1102..38ab21b7c8c 100644
--- a/src/librustc_mir/const_eval.rs
+++ b/src/librustc_mir/const_eval.rs
@@ -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,
         }