diff options
| author | oli <github35764891676564198441@oli-obk.de> | 2020-11-04 13:59:11 +0000 |
|---|---|---|
| committer | oli <github35764891676564198441@oli-obk.de> | 2020-11-04 13:59:11 +0000 |
| commit | 6e6c8a86e9f70b3be955716002d3af681039e7b8 (patch) | |
| tree | 53e32bfb7689ffc10ba15a22c6802c39bbce8bdf /compiler/rustc_codegen_cranelift/src | |
| parent | 97bfff1f56748110417ce1a44e2046e2967c074a (diff) | |
| download | rust-6e6c8a86e9f70b3be955716002d3af681039e7b8.tar.gz rust-6e6c8a86e9f70b3be955716002d3af681039e7b8.zip | |
`u64::try_from` will now fail if `ScalarInt` isn't exactly 64 bits, thus we use `to_bits` with the correct size
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/value_and_place.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/value_and_place.rs b/compiler/rustc_codegen_cranelift/src/value_and_place.rs index a40686b1931..0000866c4f6 100644 --- a/compiler/rustc_codegen_cranelift/src/value_and_place.rs +++ b/compiler/rustc_codegen_cranelift/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())) |
