about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2023-10-29 19:50:11 -0400
committerBen Kimock <kimockb@gmail.com>2023-11-01 10:54:07 -0400
commit88f06885300ae97f7fb04295cc17394df48522e4 (patch)
tree1f004bdbfd1c47f7e03b62adc817290083415cf9 /compiler/rustc_const_eval/src/interpret
parentbbcc1691a4646a6d2ebb2189bdff5b878407fbe6 (diff)
downloadrust-88f06885300ae97f7fb04295cc17394df48522e4.tar.gz
rust-88f06885300ae97f7fb04295cc17394df48522e4.zip
Avoid the path trimming ICE lint in error reporting
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
-rw-r--r--compiler/rustc_const_eval/src/interpret/cast.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs
index 8fc0205d6c7..f4cb12c8d43 100644
--- a/compiler/rustc_const_eval/src/interpret/cast.rs
+++ b/compiler/rustc_const_eval/src/interpret/cast.rs
@@ -145,16 +145,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 assert!(dest.layout.is_sized());
                 assert_eq!(cast_ty, dest.layout.ty); // we otherwise ignore `cast_ty` enirely...
                 if src.layout.size != dest.layout.size {
-                    let src_bytes = src.layout.size.bytes();
-                    let dest_bytes = dest.layout.size.bytes();
-                    let src_ty = format!("{}", src.layout.ty);
-                    let dest_ty = format!("{}", dest.layout.ty);
                     throw_ub_custom!(
                         fluent::const_eval_invalid_transmute,
-                        src_bytes = src_bytes,
-                        dest_bytes = dest_bytes,
-                        src = src_ty,
-                        dest = dest_ty,
+                        src_bytes = src.layout.size.bytes(),
+                        dest_bytes = dest.layout.size.bytes(),
+                        src = src.layout.ty,
+                        dest = dest.layout.ty,
                     );
                 }