diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-05 06:37:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-05 06:37:16 +0100 |
| commit | e348f0739d85ed962fdd517c566ec222a96b3adb (patch) | |
| tree | 14450d164a827d51eb9b95c61121205155f9bd7e /compiler/rustc_const_eval | |
| parent | 16200db7aa9c06d3ea903dff8788b23f81346517 (diff) | |
| parent | 30e7b87e2620441c489b0b755ae83e0024821b29 (diff) | |
| download | rust-e348f0739d85ed962fdd517c566ec222a96b3adb.tar.gz rust-e348f0739d85ed962fdd517c566ec222a96b3adb.zip | |
Rollup merge of #120587 - lukas-code:miri-tail-normalize, r=RalfJung
miri: normalize struct tail in ABI compat check fixes https://github.com/rust-lang/miri/issues/3282 extracted from https://github.com/rust-lang/rust/pull/120354, see https://github.com/rust-lang/rust/pull/120354#discussion_r1469154220 for context r? ```@RalfJung```
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/terminator.rs | 6 |
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" |
