From 74aad5ce56e685761ed6ea791c542a0097c7b4d7 Mon Sep 17 00:00:00 2001 From: Neven Villani Date: Tue, 20 Jun 2023 16:30:44 +0200 Subject: [PATCH] `Adt` for `Unique` may contain a reference --- compiler/rustc_mir_transform/src/add_retag.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_mir_transform/src/add_retag.rs b/compiler/rustc_mir_transform/src/add_retag.rs index 187d38b385be3..d9e7339f1b274 100644 --- a/compiler/rustc_mir_transform/src/add_retag.rs +++ b/compiler/rustc_mir_transform/src/add_retag.rs @@ -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.