about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/common.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-10 21:12:25 +0200
committerGitHub <noreply@github.com>2024-06-10 21:12:25 +0200
commit2d7f7ffba5697a1393c275d669bb1489951dd90e (patch)
tree600bd0a0dab2b4d36b74007f2a192ae78f08ac25 /compiler/rustc_codegen_ssa/src/common.rs
parentbcc6fda0ef7a8531c8cad10fadc4e27140b5bc83 (diff)
parent3c57ea0df79c8ee2ad1ff99881f80ab87b186935 (diff)
Rollup merge of #126159 - RalfJung:scalarint-size-mismatch, r=oli-obk
ScalarInt: size mismatches are a bug, do not delay the panic

Cc [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Why.20are.20ScalarInt.20to.20iN.2FuN.20methods.20fallible.3F)

r? ``@oli-obk``
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/common.rs')
-rw-r--r--compiler/rustc_codegen_ssa/src/common.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs
index e4a36b3f591..27b0f127e92 100644
--- a/compiler/rustc_codegen_ssa/src/common.rs
+++ b/compiler/rustc_codegen_ssa/src/common.rs
@@ -163,7 +163,7 @@ pub fn asm_const_to_str<'tcx>(
     let mir::ConstValue::Scalar(scalar) = const_value else {
         span_bug!(sp, "expected Scalar for promoted asm const, but got {:#?}", const_value)
     };
-    let value = scalar.assert_bits(ty_and_layout.size);
+    let value = scalar.assert_scalar_int().to_bits(ty_and_layout.size);
     match ty_and_layout.ty.kind() {
         ty::Uint(_) => value.to_string(),
         ty::Int(int_ty) => match int_ty.normalize(tcx.sess.target.pointer_width) {