Skip to content

Commit e0106d9

Browse files
committed
Assert that promoteds don't fail to be evaluated for being too generic
1 parent 4e88b73 commit e0106d9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc_mir/const_eval.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,11 @@ pub fn const_eval_provider<'a, 'tcx>(
576576
key.param_env.reveal = Reveal::UserFacing;
577577
match tcx.const_eval(key) {
578578
// try again with reveal all as requested
579-
Err(ErrorHandled::TooGeneric) => {},
579+
Err(ErrorHandled::TooGeneric) => {
580+
// Promoteds should never be "too generic" when getting evaluated.
581+
// They either don't get evaluated, or we are in a monomorphic context
582+
assert!(key.value.promoted.is_none());
583+
},
580584
// dedupliate calls
581585
other => return other,
582586
}

0 commit comments

Comments
 (0)