@@ -120,9 +120,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
120
120
self . mk_external_constraints ( data)
121
121
}
122
122
type DepNodeIndex = DepNodeIndex ;
123
- fn with_cached_task < T > ( self , task : impl FnOnce ( ) -> T ) -> ( T , DepNodeIndex ) {
124
- self . dep_graph . with_anon_task ( self , crate :: dep_graph:: dep_kinds:: TraitSelect , task)
125
- }
123
+
126
124
type Ty = Ty < ' tcx > ;
127
125
type Tys = & ' tcx List < Ty < ' tcx > > ;
128
126
@@ -158,15 +156,53 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
158
156
type Clause = Clause < ' tcx > ;
159
157
type Clauses = ty:: Clauses < ' tcx > ;
160
158
159
+ type Features = & ' tcx rustc_feature:: Features ;
160
+
161
161
type Tracked < T : fmt:: Debug + Clone > = WithDepNode < T > ;
162
+
163
+ type GenericsOf = & ' tcx ty:: Generics ;
164
+
165
+ type VariancesOf = & ' tcx [ ty:: Variance ] ;
166
+
167
+ type AdtDef = ty:: AdtDef < ' tcx > ;
168
+
169
+ type UnsizingParams = & ' tcx rustc_index:: bit_set:: BitSet < u32 > ;
170
+
171
+ fn mk_args ( self , args : & [ Self :: GenericArg ] ) -> ty:: GenericArgsRef < ' tcx > {
172
+ self . mk_args ( args)
173
+ }
174
+
175
+ fn mk_args_from_iter < I , T > ( self , args : I ) -> T :: Output
176
+ where
177
+ I : Iterator < Item = T > ,
178
+ T : CollectAndApply < Self :: GenericArg , ty:: GenericArgsRef < ' tcx > > ,
179
+ {
180
+ self . mk_args_from_iter ( args)
181
+ }
182
+ }
183
+
184
+ impl < ' tcx > RustIr for TyCtxt < ' tcx > {
185
+ type Interner = Self ;
186
+
187
+ fn interner ( self ) -> Self :: Interner {
188
+ self
189
+ }
190
+
191
+ fn with_cached_task < T > ( self , task : impl FnOnce ( ) -> T ) -> ( T , DepNodeIndex ) {
192
+ self . dep_graph . with_anon_task ( self , crate :: dep_graph:: dep_kinds:: TraitSelect , task)
193
+ }
194
+
162
195
fn mk_tracked < T : fmt:: Debug + Clone > (
163
196
self ,
164
197
data : T ,
165
198
dep_node : DepNodeIndex ,
166
- ) -> Self :: Tracked < T > {
199
+ ) -> < Self :: Interner as Interner > :: Tracked < T > {
167
200
WithDepNode :: new ( dep_node, data)
168
201
}
169
- fn get_tracked < T : fmt:: Debug + Clone > ( self , tracked : & Self :: Tracked < T > ) -> T {
202
+ fn get_tracked < T : fmt:: Debug + Clone > (
203
+ self ,
204
+ tracked : & <Self :: Interner as Interner >:: Tracked < T > ,
205
+ ) -> T {
170
206
tracked. get ( self )
171
207
}
172
208
@@ -182,24 +218,19 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
182
218
self . expand_abstract_consts ( t)
183
219
}
184
220
185
- type GenericsOf = & ' tcx ty:: Generics ;
186
-
187
221
fn generics_of ( self , def_id : DefId ) -> & ' tcx ty:: Generics {
188
222
self . generics_of ( def_id)
189
223
}
190
224
191
- type VariancesOf = & ' tcx [ ty:: Variance ] ;
192
-
193
- fn variances_of ( self , def_id : DefId ) -> Self :: VariancesOf {
225
+ fn variances_of ( self , def_id : DefId ) -> <Self :: Interner as Interner >:: VariancesOf {
194
226
self . variances_of ( def_id)
195
227
}
196
228
197
229
fn type_of ( self , def_id : DefId ) -> ty:: EarlyBinder < ' tcx , Ty < ' tcx > > {
198
230
self . type_of ( def_id)
199
231
}
200
232
201
- type AdtDef = ty:: AdtDef < ' tcx > ;
202
- fn adt_def ( self , adt_def_id : DefId ) -> Self :: AdtDef {
233
+ fn adt_def ( self , adt_def_id : DefId ) -> <Self :: Interner as Interner >:: AdtDef {
203
234
self . adt_def ( adt_def_id)
204
235
}
205
236
@@ -254,18 +285,6 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
254
285
)
255
286
}
256
287
257
- fn mk_args ( self , args : & [ Self :: GenericArg ] ) -> ty:: GenericArgsRef < ' tcx > {
258
- self . mk_args ( args)
259
- }
260
-
261
- fn mk_args_from_iter < I , T > ( self , args : I ) -> T :: Output
262
- where
263
- I : Iterator < Item = T > ,
264
- T : CollectAndApply < Self :: GenericArg , ty:: GenericArgsRef < ' tcx > > ,
265
- {
266
- self . mk_args_from_iter ( args)
267
- }
268
-
269
288
fn check_args_compatible ( self , def_id : DefId , args : ty:: GenericArgsRef < ' tcx > ) -> bool {
270
289
self . check_args_compatible ( def_id, args)
271
290
}
@@ -279,8 +298,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
279
298
/// a dummy self type and forward to `debug_assert_args_compatible`.
280
299
fn debug_assert_existential_args_compatible (
281
300
self ,
282
- def_id : Self :: DefId ,
283
- args : Self :: GenericArgs ,
301
+ def_id : < Self :: Interner as Interner > :: DefId ,
302
+ args : < Self :: Interner as Interner > :: GenericArgs ,
284
303
) {
285
304
// FIXME: We could perhaps add a `skip: usize` to `debug_assert_args_compatible`
286
305
// to avoid needing to reintern the set of args...
@@ -310,9 +329,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
310
329
self . recursion_limit ( ) . 0
311
330
}
312
331
313
- type Features = & ' tcx rustc_feature:: Features ;
314
-
315
- fn features ( self ) -> Self :: Features {
332
+ fn features ( self ) -> <Self :: Interner as Interner >:: Features {
316
333
self . features ( )
317
334
}
318
335
@@ -611,15 +628,17 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
611
628
self . coroutine_is_async_gen ( coroutine_def_id)
612
629
}
613
630
614
- type UnsizingParams = & ' tcx rustc_index:: bit_set:: BitSet < u32 > ;
615
- fn unsizing_params_for_adt ( self , adt_def_id : DefId ) -> Self :: UnsizingParams {
631
+ fn unsizing_params_for_adt (
632
+ self ,
633
+ adt_def_id : DefId ,
634
+ ) -> <Self :: Interner as Interner >:: UnsizingParams {
616
635
self . unsizing_params_for_adt ( adt_def_id)
617
636
}
618
637
619
638
fn find_const_ty_from_env (
620
639
self ,
621
640
param_env : & ty:: ParamEnv < ' tcx > ,
622
- placeholder : Self :: PlaceholderConst ,
641
+ placeholder : < Self :: Interner as Interner > :: PlaceholderConst ,
623
642
) -> Ty < ' tcx > {
624
643
placeholder. find_const_ty_from_env ( param_env)
625
644
}
@@ -631,19 +650,14 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
631
650
self . anonymize_bound_vars ( binder)
632
651
}
633
652
634
- fn opaque_types_defined_by ( self , defining_anchor : LocalDefId ) -> Self :: DefiningOpaqueTypes {
653
+ fn opaque_types_defined_by (
654
+ self ,
655
+ defining_anchor : LocalDefId ,
656
+ ) -> <Self :: Interner as Interner >:: DefiningOpaqueTypes {
635
657
self . opaque_types_defined_by ( defining_anchor)
636
658
}
637
659
}
638
660
639
- impl < ' tcx > RustIr for TyCtxt < ' tcx > {
640
- type Interner = Self ;
641
-
642
- fn interner ( self ) -> Self :: Interner {
643
- self
644
- }
645
- }
646
-
647
661
macro_rules! bidirectional_lang_item_map {
648
662
( $( $name: ident) ,+ $( , ) ?) => {
649
663
fn trait_lang_item_to_lang_item( lang_item: TraitSolverLangItem ) -> LangItem {
0 commit comments