@@ -141,6 +141,7 @@ pub struct CtxtInterners<'tcx> {
141141 type_ : InternedSet < ' tcx , WithCachedTypeInfo < TyKind < ' tcx > > > ,
142142 const_lists : InternedSet < ' tcx , List < ty:: Const < ' tcx > > > ,
143143 substs : InternedSet < ' tcx , InternalSubsts < ' tcx > > ,
144+ type_lists : InternedSet < ' tcx , List < Ty < ' tcx > > > ,
144145 canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo < ' tcx > > > ,
145146 region : InternedSet < ' tcx , RegionKind < ' tcx > > ,
146147 poly_existential_predicates : InternedSet < ' tcx , List < PolyExistentialPredicate < ' tcx > > > ,
@@ -163,6 +164,7 @@ impl<'tcx> CtxtInterners<'tcx> {
163164 type_ : Default :: default ( ) ,
164165 const_lists : Default :: default ( ) ,
165166 substs : Default :: default ( ) ,
167+ type_lists : Default :: default ( ) ,
166168 region : Default :: default ( ) ,
167169 poly_existential_predicates : Default :: default ( ) ,
168170 canonical_var_infos : Default :: default ( ) ,
@@ -1278,25 +1280,6 @@ macro_rules! nop_lift {
12781280 } ;
12791281}
12801282
1281- // Can't use the macros as we have reuse the `substs` here.
1282- //
1283- // See `mk_type_list` for more info.
1284- impl < ' a , ' tcx > Lift < ' tcx > for & ' a List < Ty < ' a > > {
1285- type Lifted = & ' tcx List < Ty < ' tcx > > ;
1286- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
1287- if self . is_empty ( ) {
1288- return Some ( List :: empty ( ) ) ;
1289- }
1290-
1291- tcx. interners
1292- . substs
1293- . contains_pointer_to ( & InternedInSet ( self . as_substs ( ) ) )
1294- // SAFETY: `self` is interned and therefore valid
1295- // for the entire lifetime of the `TyCtxt`.
1296- . then ( || unsafe { mem:: transmute :: < & ' a List < Ty < ' a > > , & ' tcx List < Ty < ' tcx > > > ( self ) } )
1297- }
1298- }
1299-
13001283macro_rules! nop_list_lift {
13011284 ( $set: ident; $ty: ty => $lifted: ty) => {
13021285 impl <' a, ' tcx> Lift <' tcx> for & ' a List <$ty> {
@@ -1320,6 +1303,7 @@ nop_lift! {const_; Const<'a> => Const<'tcx>}
13201303nop_lift ! { const_allocation; ConstAllocation <' a> => ConstAllocation <' tcx>}
13211304nop_lift ! { predicate; Predicate <' a> => Predicate <' tcx>}
13221305
1306+ nop_list_lift ! { type_lists; Ty <' a> => Ty <' tcx>}
13231307nop_list_lift ! { poly_existential_predicates; PolyExistentialPredicate <' a> => PolyExistentialPredicate <' tcx>}
13241308nop_list_lift ! { predicates; Predicate <' a> => Predicate <' tcx>}
13251309nop_list_lift ! { canonical_var_infos; CanonicalVarInfo <' a> => CanonicalVarInfo <' tcx>}
@@ -1594,6 +1578,7 @@ macro_rules! slice_interners {
15941578slice_interners ! (
15951579 const_lists: pub mk_const_list( Const <' tcx>) ,
15961580 substs: pub mk_substs( GenericArg <' tcx>) ,
1581+ type_lists: pub mk_type_list( Ty <' tcx>) ,
15971582 canonical_var_infos: pub mk_canonical_var_infos( CanonicalVarInfo <' tcx>) ,
15981583 poly_existential_predicates: intern_poly_existential_predicates( PolyExistentialPredicate <' tcx>) ,
15991584 predicates: intern_predicates( Predicate <' tcx>) ,
@@ -2193,18 +2178,6 @@ impl<'tcx> TyCtxt<'tcx> {
21932178 T :: collect_and_apply ( iter, |xs| self . mk_const_list ( xs) )
21942179 }
21952180
2196- pub fn mk_type_list ( self , ts : & [ Ty < ' tcx > ] ) -> & ' tcx List < Ty < ' tcx > > {
2197- // Actually intern type lists as lists of `GenericArg`s.
2198- //
2199- // Transmuting from `Ty<'tcx>` to `GenericArg<'tcx>` is sound
2200- // as explained in `ty_slice_as_generic_arg`. With this,
2201- // we guarantee that even when transmuting between `List<Ty<'tcx>>`
2202- // and `List<GenericArg<'tcx>>`, the uniqueness requirement for
2203- // lists is upheld.
2204- let substs = self . mk_substs ( ty:: subst:: ty_slice_as_generic_args ( ts) ) ;
2205- substs. try_as_type_list ( ) . unwrap ( )
2206- }
2207-
22082181 // Unlike various other `mk_*_from_iter` functions, this one uses `I:
22092182 // IntoIterator` instead of `I: Iterator`, and it doesn't have a slice
22102183 // variant, because of the need to combine `inputs` and `output`. This
0 commit comments