Skip to content

Commit fed3b26

Browse files
committed
Don't panic on reported const eval errors
1 parent 2a08220 commit fed3b26

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/constant.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ pub fn force_eval_const<'tcx>(
8585
match const_.val {
8686
ConstKind::Unevaluated(def_id, ref substs) => {
8787
let substs = fx.monomorphize(substs);
88-
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def_id, substs, None).unwrap()
88+
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def_id, substs, None).unwrap_or_else(|_| {
89+
fx.tcx.sess.abort_if_errors();
90+
unreachable!();
91+
})
8992
}
9093
_ => fx.monomorphize(&const_),
9194
}

0 commit comments

Comments
 (0)