about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroli <github35764891676564198441@oli-obk.de>2020-11-04 13:59:11 +0000
committeroli <github35764891676564198441@oli-obk.de>2020-11-04 13:59:11 +0000
commit6e96e10f9363dc792acb02ff616aaca36764805d (patch)
tree168b60cc301dc49a08b20f084e387fca72935a07
parent5fa1c8f91a046b8e84443c93214d5f0e0df67eee (diff)
downloadrust-6e96e10f9363dc792acb02ff616aaca36764805d.tar.gz
rust-6e96e10f9363dc792acb02ff616aaca36764805d.zip
`u64::try_from` will now fail if `ScalarInt` isn't exactly 64 bits, thus we use `to_bits` with the correct size
-rw-r--r--src/value_and_place.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/value_and_place.rs b/src/value_and_place.rs
index a40686b1931..0000866c4f6 100644
--- a/src/value_and_place.rs
+++ b/src/value_and_place.rs
@@ -261,7 +261,7 @@ impl<'tcx> CValue<'tcx> {
                 fx
                     .bcx
                     .ins()
-                    .iconst(clif_ty, u64::try_from(const_val).expect("uint") as i64)
+                    .iconst(clif_ty, const_val.to_bits(layout.size).unwrap() as i64)
             }
             ty::Float(FloatTy::F32) => {
                 fx.bcx.ins().f32const(Ieee32::with_bits(u32::try_from(const_val).unwrap()))