Skip to content

Commit ed48853

Browse files
committed
simplify eval_mir_constant
1 parent 0c5c3bb commit ed48853

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/librustc_codegen_ssa/mir/constant.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
4040
&mut self,
4141
constant: &mir::Constant<'tcx>,
4242
) -> Result<ConstValue<'tcx>, ErrorHandled> {
43-
let const_ = match constant.literal.val {
44-
ty::ConstKind::Unevaluated(def_id, substs, promoted) => {
45-
let substs = self.monomorphize(&substs);
46-
ty::ConstKind::Unevaluated(def_id, substs, promoted)
47-
}
48-
ty::ConstKind::Value(value) => ty::ConstKind::Value(value),
49-
ty::ConstKind::Param(_) => self.monomorphize(&constant.literal).val,
50-
_ => span_bug!(constant.span, "encountered bad Const in codegen: {:?}", constant),
51-
};
52-
53-
match const_ {
43+
match self.monomorphize(&constant.literal).val {
5444
ty::ConstKind::Unevaluated(def_id, substs, promoted) => self
5545
.cx
5646
.tcx()
@@ -65,10 +55,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
6555
err
6656
}),
6757
ty::ConstKind::Value(value) => Ok(value),
68-
_ => span_bug!(
58+
err => span_bug!(
6959
constant.span,
7060
"encountered bad ConstKind after monomorphizing: {:?}",
71-
const_
61+
err
7262
),
7363
}
7464
}

0 commit comments

Comments
 (0)