@@ -141,6 +141,7 @@ pub struct CtxtInterners<'tcx> {
141
141
type_ : InternedSet < ' tcx , WithCachedTypeInfo < TyKind < ' tcx > > > ,
142
142
const_lists : InternedSet < ' tcx , List < ty:: Const < ' tcx > > > ,
143
143
substs : InternedSet < ' tcx , InternalSubsts < ' tcx > > ,
144
+ type_lists : InternedSet < ' tcx , List < Ty < ' tcx > > > ,
144
145
canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo < ' tcx > > > ,
145
146
region : InternedSet < ' tcx , RegionKind < ' tcx > > ,
146
147
poly_existential_predicates : InternedSet < ' tcx , List < PolyExistentialPredicate < ' tcx > > > ,
@@ -163,6 +164,7 @@ impl<'tcx> CtxtInterners<'tcx> {
163
164
type_ : Default :: default ( ) ,
164
165
const_lists : Default :: default ( ) ,
165
166
substs : Default :: default ( ) ,
167
+ type_lists : Default :: default ( ) ,
166
168
region : Default :: default ( ) ,
167
169
poly_existential_predicates : Default :: default ( ) ,
168
170
canonical_var_infos : Default :: default ( ) ,
@@ -1278,25 +1280,6 @@ macro_rules! nop_lift {
1278
1280
} ;
1279
1281
}
1280
1282
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
-
1300
1283
macro_rules! nop_list_lift {
1301
1284
( $set: ident; $ty: ty => $lifted: ty) => {
1302
1285
impl <' a, ' tcx> Lift <' tcx> for & ' a List <$ty> {
@@ -1320,6 +1303,7 @@ nop_lift! {const_; Const<'a> => Const<'tcx>}
1320
1303
nop_lift ! { const_allocation; ConstAllocation <' a> => ConstAllocation <' tcx>}
1321
1304
nop_lift ! { predicate; Predicate <' a> => Predicate <' tcx>}
1322
1305
1306
+ nop_list_lift ! { type_lists; Ty <' a> => Ty <' tcx>}
1323
1307
nop_list_lift ! { poly_existential_predicates; PolyExistentialPredicate <' a> => PolyExistentialPredicate <' tcx>}
1324
1308
nop_list_lift ! { predicates; Predicate <' a> => Predicate <' tcx>}
1325
1309
nop_list_lift ! { canonical_var_infos; CanonicalVarInfo <' a> => CanonicalVarInfo <' tcx>}
@@ -1594,6 +1578,7 @@ macro_rules! slice_interners {
1594
1578
slice_interners ! (
1595
1579
const_lists: pub mk_const_list( Const <' tcx>) ,
1596
1580
substs: pub mk_substs( GenericArg <' tcx>) ,
1581
+ type_lists: pub mk_type_list( Ty <' tcx>) ,
1597
1582
canonical_var_infos: pub mk_canonical_var_infos( CanonicalVarInfo <' tcx>) ,
1598
1583
poly_existential_predicates: intern_poly_existential_predicates( PolyExistentialPredicate <' tcx>) ,
1599
1584
predicates: intern_predicates( Predicate <' tcx>) ,
@@ -2193,18 +2178,6 @@ impl<'tcx> TyCtxt<'tcx> {
2193
2178
T :: collect_and_apply ( iter, |xs| self . mk_const_list ( xs) )
2194
2179
}
2195
2180
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
-
2208
2181
// Unlike various other `mk_*_from_iter` functions, this one uses `I:
2209
2182
// IntoIterator` instead of `I: Iterator`, and it doesn't have a slice
2210
2183
// variant, because of the need to combine `inputs` and `output`. This
0 commit comments