1
1
use rustc_data_structures::fx::FxIndexSet;
2
+ use rustc_hir as hir;
2
3
use rustc_hir::def::DefKind;
3
4
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId};
4
5
use rustc_hir::intravisit::{self, Visitor};
5
- use rustc_hir::{self as hir, HirId};
6
- use rustc_index::IndexVec;
7
6
use rustc_middle::query::Providers;
8
- use rustc_middle::ty::{self, ImplTraitInTraitData, TyCtxt, TyCtxtFeed };
7
+ use rustc_middle::ty::{self, ImplTraitInTraitData, TyCtxt};
9
8
use rustc_span::symbol::kw;
10
9
11
10
pub(crate) fn provide(providers: &mut Providers) {
@@ -238,26 +237,6 @@ fn associated_types_for_impl_traits_in_associated_fn(
238
237
}
239
238
}
240
239
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
-
261
240
/// Given an `opaque_ty_def_id` corresponding to an `impl Trait` in an associated
262
241
/// function from a trait, synthesize an associated type for that `impl Trait`
263
242
/// 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(
279
258
let local_def_id = trait_assoc_ty.def_id();
280
259
let def_id = local_def_id.to_def_id();
281
260
282
- feed_hir(&trait_assoc_ty );
261
+ trait_assoc_ty. feed_hir();
283
262
284
263
// Copy span of the opaque.
285
264
trait_assoc_ty.def_ident_span(Some(span));
@@ -333,7 +312,7 @@ fn associated_type_for_impl_trait_in_impl(
333
312
let local_def_id = impl_assoc_ty.def_id();
334
313
let def_id = local_def_id.to_def_id();
335
314
336
- feed_hir(&impl_assoc_ty );
315
+ impl_assoc_ty. feed_hir();
337
316
338
317
// Copy span of the opaque.
339
318
impl_assoc_ty.def_ident_span(Some(span));
0 commit comments