diff --git a/src/librustc_trans/trans/mir/rvalue.rs b/src/librustc_trans/trans/mir/rvalue.rs index 6c4fa9cd3bd..d2806f3daba 100644 --- a/src/librustc_trans/trans/mir/rvalue.rs +++ b/src/librustc_trans/trans/mir/rvalue.rs @@ -248,15 +248,12 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { let r_t_out = CastTy::from_ty(cast_ty).expect("bad output type for cast"); let ll_t_in = type_of::immediate_type_of(bcx.ccx(), operand.ty); let ll_t_out = type_of::immediate_type_of(bcx.ccx(), cast_ty); - let (llval, ll_t_in, signed) = if let CastTy::Int(IntTy::CEnum) = r_t_in { + let llval = operand.immediate(); + let signed = if let CastTy::Int(IntTy::CEnum) = r_t_in { let repr = adt::represent_type(bcx.ccx(), operand.ty); - let llval = operand.immediate(); - let discr = bcx.with_block(|bcx| { - adt::trans_get_discr(bcx, &repr, llval, None, true) - }); - (discr, common::val_ty(discr), adt::is_discr_signed(&repr)) + adt::is_discr_signed(&repr) } else { - (operand.immediate(), ll_t_in, operand.ty.is_signed()) + operand.ty.is_signed() }; let newval = match (r_t_in, r_t_out) {