@@ -28,11 +28,10 @@ use rustc_errors::{
28
28
} ;
29
29
use rustc_hir:: def:: DefKind ;
30
30
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
31
- use rustc_hir:: intravisit:: { self , InferKind , Visitor , VisitorExt , walk_generics} ;
31
+ use rustc_hir:: intravisit:: { InferKind , Visitor , VisitorExt , walk_generics} ;
32
32
use rustc_hir:: { self as hir, GenericParamKind , HirId , Node , PreciseCapturingArgKind } ;
33
33
use rustc_infer:: infer:: { InferCtxt , TyCtxtInferExt } ;
34
34
use rustc_infer:: traits:: { DynCompatibilityViolation , ObligationCause } ;
35
- use rustc_middle:: hir:: nested_filter;
36
35
use rustc_middle:: query:: Providers ;
37
36
use rustc_middle:: ty:: util:: { Discr , IntTypeExt } ;
38
37
use rustc_middle:: ty:: { self , AdtKind , Const , IsSuggestable , Ty , TyCtxt , TypingMode , fold_regions} ;
@@ -148,10 +147,6 @@ impl<'v> Visitor<'v> for HirPlaceholderCollector {
148
147
}
149
148
}
150
149
151
- pub ( crate ) struct CollectItemTypesVisitor < ' tcx > {
152
- pub tcx : TyCtxt < ' tcx > ,
153
- }
154
-
155
150
/// If there are any placeholder types (`_`), emit an error explaining that this is not allowed
156
151
/// and suggest adding type parameters in the appropriate place, taking into consideration any and
157
152
/// all already existing generic type parameters to avoid suggesting a name that is already in use.
@@ -243,7 +238,7 @@ pub(crate) fn placeholder_type_error_diag<'cx, 'tcx>(
243
238
err
244
239
}
245
240
246
- fn reject_placeholder_type_signatures_in_item < ' tcx > (
241
+ pub ( super ) fn reject_placeholder_type_signatures_in_item < ' tcx > (
247
242
tcx : TyCtxt < ' tcx > ,
248
243
item : & ' tcx hir:: Item < ' tcx > ,
249
244
) {
@@ -274,30 +269,6 @@ fn reject_placeholder_type_signatures_in_item<'tcx>(
274
269
) ;
275
270
}
276
271
277
- impl < ' tcx > Visitor < ' tcx > for CollectItemTypesVisitor < ' tcx > {
278
- type NestedFilter = nested_filter:: OnlyBodies ;
279
-
280
- fn maybe_tcx ( & mut self ) -> Self :: MaybeTyCtxt {
281
- self . tcx
282
- }
283
-
284
- fn visit_item ( & mut self , item : & ' tcx hir:: Item < ' tcx > ) {
285
- lower_item ( self . tcx , item. item_id ( ) ) ;
286
- reject_placeholder_type_signatures_in_item ( self . tcx , item) ;
287
- intravisit:: walk_item ( self , item) ;
288
- }
289
-
290
- fn visit_trait_item ( & mut self , trait_item : & ' tcx hir:: TraitItem < ' tcx > ) {
291
- lower_trait_item ( self . tcx , trait_item. trait_item_id ( ) ) ;
292
- intravisit:: walk_trait_item ( self , trait_item) ;
293
- }
294
-
295
- fn visit_impl_item ( & mut self , impl_item : & ' tcx hir:: ImplItem < ' tcx > ) {
296
- lower_impl_item ( self . tcx , impl_item. impl_item_id ( ) ) ;
297
- intravisit:: walk_impl_item ( self , impl_item) ;
298
- }
299
- }
300
-
301
272
///////////////////////////////////////////////////////////////////////////
302
273
// Utility types and common code for the above passes.
303
274
@@ -618,7 +589,7 @@ fn get_new_lifetime_name<'tcx>(
618
589
}
619
590
620
591
#[ instrument( level = "debug" , skip_all) ]
621
- fn lower_item ( tcx : TyCtxt < ' _ > , item_id : hir:: ItemId ) {
592
+ pub ( super ) fn lower_item ( tcx : TyCtxt < ' _ > , item_id : hir:: ItemId ) {
622
593
let it = tcx. hir_item ( item_id) ;
623
594
debug ! ( item = ?it. kind. ident( ) , id = %it. hir_id( ) ) ;
624
595
let def_id = item_id. owner_id . def_id ;
@@ -739,7 +710,7 @@ fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
739
710
}
740
711
}
741
712
742
- fn lower_trait_item ( tcx : TyCtxt < ' _ > , trait_item_id : hir:: TraitItemId ) {
713
+ pub ( crate ) fn lower_trait_item ( tcx : TyCtxt < ' _ > , trait_item_id : hir:: TraitItemId ) {
743
714
let trait_item = tcx. hir_trait_item ( trait_item_id) ;
744
715
let def_id = trait_item_id. owner_id ;
745
716
tcx. ensure_ok ( ) . generics_of ( def_id) ;
@@ -810,7 +781,7 @@ fn lower_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
810
781
tcx. ensure_ok ( ) . predicates_of ( def_id) ;
811
782
}
812
783
813
- fn lower_impl_item ( tcx : TyCtxt < ' _ > , impl_item_id : hir:: ImplItemId ) {
784
+ pub ( super ) fn lower_impl_item ( tcx : TyCtxt < ' _ > , impl_item_id : hir:: ImplItemId ) {
814
785
let def_id = impl_item_id. owner_id ;
815
786
tcx. ensure_ok ( ) . generics_of ( def_id) ;
816
787
tcx. ensure_ok ( ) . type_of ( def_id) ;
0 commit comments