1
Fork 0

Rollup merge of #112844 - Vanille-N:unique, r=RalfJung

Add retag in MIR transform: `Adt` for `Unique` may contain a reference

Following #112662 , `may_contain_reference` in `rustc_mir_transform::add_retag` underapproximates too much the types that require retagging.

r? ``@RalfJung``
This commit is contained in:
Nilstrieb 2023-06-21 07:37:03 +02:00 committed by GitHub
commit 82e6a16e33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,7 @@ fn may_contain_reference<'tcx>(ty: Ty<'tcx>, depth: u32, tcx: TyCtxt<'tcx>) -> b
// References
ty::Ref(..) => true,
ty::Adt(..) if ty.is_box() => true,
ty::Adt(adt, _) if Some(adt.did()) == tcx.lang_items().ptr_unique() => true,
// Compound types: recurse
ty::Array(ty, _) | ty::Slice(ty) => {
// This does not branch so we keep the depth the same.