Skip to content

Commit 1f53fdc

Browse files
committed
get rid of useless back-and-forth cast
1 parent 1a0e69d commit 1f53fdc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/librustc_mir/interpret/operand.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
621621
let real_discr = if discr_val.layout.abi.is_signed() {
622622
// going from layout tag type to typeck discriminant type
623623
// requires first sign extending with the discriminant layout
624-
let sexted = sign_extend(bits_discr, discr_val.layout.size) as i128;
624+
let sexted = sign_extend(bits_discr, discr_val.layout.size);
625625
// and then zeroing with the typeck discriminant type
626626
let discr_ty = rval
627627
.layout
@@ -631,8 +631,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
631631
.repr
632632
.discr_type();
633633
let size = layout::Integer::from_attr(self, discr_ty).size();
634-
let truncatee = sexted as u128;
635-
truncate(truncatee, size)
634+
truncate(sexted, size)
636635
} else {
637636
bits_discr
638637
};

0 commit comments

Comments
 (0)