Skip to content

Commit 5fa1c8f

Browse files
committed
u128 truncation and sign extension are not just interpreter related
1 parent 0dcf78b commit 5fa1c8f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/base.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,7 @@ fn codegen_stmt<'tcx>(
585585
.discriminant_for_variant(fx.tcx, *index)
586586
.unwrap();
587587
let discr = if discr.ty.is_signed() {
588-
rustc_middle::mir::interpret::sign_extend(
589-
discr.val,
590-
fx.layout_of(discr.ty).size,
591-
)
588+
fx.layout_of(discr.ty).size.sign_extend(discr.val)
592589
} else {
593590
discr.val
594591
};

0 commit comments

Comments
 (0)