Skip to content

Commit 6e6c8a8

Browse files
committed
u64::try_from will now fail if ScalarInt isn't exactly 64 bits, thus we use to_bits with the correct size
1 parent 97bfff1 commit 6e6c8a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_codegen_cranelift/src/value_and_place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<'tcx> CValue<'tcx> {
261261
fx
262262
.bcx
263263
.ins()
264-
.iconst(clif_ty, u64::try_from(const_val).expect("uint") as i64)
264+
.iconst(clif_ty, const_val.to_bits(layout.size).unwrap() as i64)
265265
}
266266
ty::Float(FloatTy::F32) => {
267267
fx.bcx.ins().f32const(Ieee32::with_bits(u32::try_from(const_val).unwrap()))

0 commit comments

Comments
 (0)