about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-22 11:37:03 +0100
committerGitHub <noreply@github.com>2024-03-22 11:37:03 +0100
commit3164a47fcd9760547577debe8c9089701239e832 (patch)
treeb1fad038589704424fa4bf18fff3d39cefede6d6
parentb317cda7ea1ced6f5a6da42dbcd2c508255d6612 (diff)
parent861e47000f8bb35c76290c28f86757a4f5463c6c (diff)
Rollup merge of #122855 - workingjubilee:mangle-64-bit-chauvinism, r=compiler-errors
Fix Itanium mangling usizes

Arrays, surprisingly, are not sized to u64 on all platforms.

Fixes #122851.

r? ```@compiler-errors```

cc ```@maurer```
-rw-r--r--compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs b/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
index 76a5d942c66..69b9fc33166 100644
--- a/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
+++ b/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
@@ -525,8 +525,8 @@ fn encode_ty<'tcx>(
                 "{}",
                 &len.try_to_scalar()
                     .unwrap()
-                    .to_u64()
-                    .unwrap_or_else(|_| panic!("failed to convert length to u64"))
+                    .to_target_usize(&tcx.data_layout)
+                    .expect("Array lens are defined in usize")
             );
             s.push_str(&encode_ty(tcx, *ty0, dict, options));
             compress(dict, DictKey::Ty(ty, TyQ::None), &mut s);