diff --git a/frontend/exporter/src/types/copied.rs b/frontend/exporter/src/types/copied.rs index 2fcb8f874..69944cd61 100644 --- a/frontend/exporter/src/types/copied.rs +++ b/frontend/exporter/src/types/copied.rs @@ -225,7 +225,7 @@ impl<'tcx, S: UnderOwnerState<'tcx>> SInto for rustc_middle::mi fn sinto(&self, s: &S) -> ConstantExpr { use rustc_middle::mir::Const; let tcx = s.base().tcx; - match self.eval_constant(s).as_ref().unwrap_or(self) { + match self { Const::Val(const_value, ty) => const_value_to_constant_expr( s, ty.clone(), @@ -239,7 +239,11 @@ impl<'tcx, S: UnderOwnerState<'tcx>> SInto for rustc_middle::mi .def_ident_span(ucv.def) .unwrap_or_else(|| ucv.def.default_span(tcx)); if let Some(_) = ucv.promoted { - supposely_unreachable_fatal!(s[span], "PromotedConstant"; {ucv.def}) + self.eval_constant(s) + .unwrap_or_else(|| { + supposely_unreachable_fatal!(s, "UnevalPromotedConstant"; {self, ucv}); + }) + .sinto(s) } else { match self.translate_uneval(s, ucv.shrink(), span) { TranslateUnevalRes::EvaluatedConstant(c) => c.sinto(s),