From ca5525d5643f4eb7de5c5e69d0691fc8f1cacfca Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Sat, 5 Mar 2022 07:28:41 +1100 Subject: Improve `AdtDef` interning. This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`. --- .../rustc_const_eval/src/transform/check_consts/qualifs.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'compiler/rustc_const_eval/src/transform') diff --git a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs index 6421ba9df0f..4ea21b4d06d 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs @@ -71,7 +71,7 @@ pub trait Qualif { /// Returning `true` for `in_adt_inherently` but `false` for `in_any_value_of_ty` is unsound. fn in_adt_inherently<'tcx>( cx: &ConstCx<'_, 'tcx>, - adt: &'tcx AdtDef, + adt: AdtDef<'tcx>, substs: SubstsRef<'tcx>, ) -> bool; } @@ -96,12 +96,12 @@ impl Qualif for HasMutInterior { fn in_adt_inherently<'tcx>( cx: &ConstCx<'_, 'tcx>, - adt: &'tcx AdtDef, + adt: AdtDef<'tcx>, _: SubstsRef<'tcx>, ) -> bool { // Exactly one type, `UnsafeCell`, has the `HasMutInterior` qualif inherently. // It arises structurally for all other types. - Some(adt.did) == cx.tcx.lang_items().unsafe_cell_type() + Some(adt.did()) == cx.tcx.lang_items().unsafe_cell_type() } } @@ -126,7 +126,7 @@ impl Qualif for NeedsDrop { fn in_adt_inherently<'tcx>( cx: &ConstCx<'_, 'tcx>, - adt: &'tcx AdtDef, + adt: AdtDef<'tcx>, _: SubstsRef<'tcx>, ) -> bool { adt.has_dtor(cx.tcx) @@ -205,7 +205,7 @@ impl Qualif for NeedsNonConstDrop { fn in_adt_inherently<'tcx>( cx: &ConstCx<'_, 'tcx>, - adt: &'tcx AdtDef, + adt: AdtDef<'tcx>, _: SubstsRef<'tcx>, ) -> bool { adt.has_non_const_dtor(cx.tcx) @@ -233,7 +233,7 @@ impl Qualif for CustomEq { fn in_adt_inherently<'tcx>( cx: &ConstCx<'_, 'tcx>, - adt: &'tcx AdtDef, + adt: AdtDef<'tcx>, substs: SubstsRef<'tcx>, ) -> bool { let ty = cx.tcx.mk_ty(ty::Adt(adt, substs)); -- cgit 1.4.1-3-g733a5