Don't panic on reported const eval errors

This commit is contained in:
bjorn3 2020-01-11 14:20:55 +01:00
parent 2a082209a6
commit fed3b26563

View file

@ -85,7 +85,10 @@ pub fn force_eval_const<'tcx>(
match const_.val {
ConstKind::Unevaluated(def_id, ref substs) => {
let substs = fx.monomorphize(substs);
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def_id, substs, None).unwrap()
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def_id, substs, None).unwrap_or_else(|_| {
fx.tcx.sess.abort_if_errors();
unreachable!();
})
}
_ => fx.monomorphize(&const_),
}