11use rustc_data_structures:: fx:: FxIndexSet ;
2+ use rustc_hir as hir;
23use rustc_hir:: def:: DefKind ;
34use rustc_hir:: def_id:: { DefId , DefIdMap , LocalDefId } ;
45use rustc_hir:: intravisit:: { self , Visitor } ;
5- use rustc_hir:: { self as hir, HirId } ;
6- use rustc_index:: IndexVec ;
76use rustc_middle:: query:: Providers ;
8- use rustc_middle:: ty:: { self , ImplTraitInTraitData , TyCtxt , TyCtxtFeed } ;
7+ use rustc_middle:: ty:: { self , ImplTraitInTraitData , TyCtxt } ;
98use rustc_span:: symbol:: kw;
109
1110pub ( crate ) fn provide ( providers : & mut Providers ) {
@@ -238,26 +237,6 @@ fn associated_types_for_impl_traits_in_associated_fn(
238237 }
239238}
240239
241- fn feed_hir ( feed : & TyCtxtFeed < ' _ , LocalDefId > ) {
242- feed. local_def_id_to_hir_id ( HirId :: make_owner ( feed. def_id ( ) ) ) ;
243-
244- let node = hir:: OwnerNode :: Synthetic ;
245- let bodies = Default :: default ( ) ;
246- let attrs = hir:: AttributeMap :: EMPTY ;
247-
248- let ( opt_hash_including_bodies, _) = feed. tcx . hash_owner_nodes ( node, & bodies, & attrs. map ) ;
249- let node = node. into ( ) ;
250- feed. opt_hir_owner_nodes ( Some ( feed. tcx . arena . alloc ( hir:: OwnerNodes {
251- opt_hash_including_bodies,
252- nodes : IndexVec :: from_elem_n (
253- hir:: ParentedNode { parent : hir:: ItemLocalId :: INVALID , node } ,
254- 1 ,
255- ) ,
256- bodies,
257- } ) ) ) ;
258- feed. feed_owner_id ( ) . hir_attrs ( attrs) ;
259- }
260-
261240/// Given an `opaque_ty_def_id` corresponding to an `impl Trait` in an associated
262241/// function from a trait, synthesize an associated type for that `impl Trait`
263242/// that inherits properties that we infer from the method and the opaque type.
@@ -279,7 +258,7 @@ fn associated_type_for_impl_trait_in_trait(
279258 let local_def_id = trait_assoc_ty. def_id ( ) ;
280259 let def_id = local_def_id. to_def_id ( ) ;
281260
282- feed_hir ( & trait_assoc_ty ) ;
261+ trait_assoc_ty . feed_hir ( ) ;
283262
284263 // Copy span of the opaque.
285264 trait_assoc_ty. def_ident_span ( Some ( span) ) ;
@@ -333,7 +312,7 @@ fn associated_type_for_impl_trait_in_impl(
333312 let local_def_id = impl_assoc_ty. def_id ( ) ;
334313 let def_id = local_def_id. to_def_id ( ) ;
335314
336- feed_hir ( & impl_assoc_ty ) ;
315+ impl_assoc_ty . feed_hir ( ) ;
337316
338317 // Copy span of the opaque.
339318 impl_assoc_ty. def_ident_span ( Some ( span) ) ;
0 commit comments