Skip to content

Commit

Permalink
Rollup merge of rust-lang#112844 - Vanille-N:unique, r=RalfJung
Browse files Browse the repository at this point in the history
Add retag in MIR transform: `Adt` for `Unique` may contain a reference

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

r? ``@RalfJung``
  • Loading branch information
Nilstrieb committed Jun 21, 2023
2 parents 904994e + 74aad5c commit 82e6a16
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_mir_transform/src/add_retag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 82e6a16

Please sign in to comment.