about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/terminator.rs
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2024-02-02 21:27:50 +0100
committerLukas Markeffsky <@>2024-02-02 21:39:00 +0100
commit30e7b87e2620441c489b0b755ae83e0024821b29 (patch)
treea1bb11953c4c7d15df66237097145a7fca19b926 /compiler/rustc_const_eval/src/interpret/terminator.rs
parentbf3c6c5bed498f41ad815641319a1ad9bcecb8e8 (diff)
downloadrust-30e7b87e2620441c489b0b755ae83e0024821b29.tar.gz
rust-30e7b87e2620441c489b0b755ae83e0024821b29.zip
miri: normalize struct tail in ABI compat check
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/terminator.rs')
-rw-r--r--compiler/rustc_const_eval/src/interpret/terminator.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs
index 7b993279f18..b7ffb4a16fc 100644
--- a/compiler/rustc_const_eval/src/interpret/terminator.rs
+++ b/compiler/rustc_const_eval/src/interpret/terminator.rs
@@ -373,7 +373,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
         if let (Some(caller), Some(callee)) = (pointee_ty(caller.ty)?, pointee_ty(callee.ty)?) {
             // This is okay if they have the same metadata type.
             let meta_ty = |ty: Ty<'tcx>| {
-                let (meta, only_if_sized) = ty.ptr_metadata_ty(*self.tcx, |ty| ty);
+                // Even if `ty` is normalized, the search for the unsized tail will project
+                // to fields, which can yield non-normalized types. So we need to provide a
+                // normalization function.
+                let normalize = |ty| self.tcx.normalize_erasing_regions(self.param_env, ty);
+                let (meta, only_if_sized) = ty.ptr_metadata_ty(*self.tcx, normalize);
                 assert!(
                     !only_if_sized,
                     "there should be no more 'maybe has that metadata' types during interpretation"