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```
This commit is contained in:
commit
e348f0739d
2 changed files with 25 additions and 1 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue