diff options
Diffstat (limited to 'compiler/rustc_hir_analysis/src/collect/dump.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/dump.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/dump.rs b/compiler/rustc_hir_analysis/src/collect/dump.rs index 41f8465ae91..4debd3977f5 100644 --- a/compiler/rustc_hir_analysis/src/collect/dump.rs +++ b/compiler/rustc_hir_analysis/src/collect/dump.rs @@ -52,7 +52,7 @@ pub(crate) fn predicates_and_item_bounds(tcx: TyCtxt<'_>) { } pub(crate) fn def_parents(tcx: TyCtxt<'_>) { - for iid in tcx.hir().items() { + for iid in tcx.hir_free_items() { let did = iid.owner_id.def_id; if tcx.has_attr(did, sym::rustc_dump_def_parents) { struct AnonConstFinder<'tcx> { @@ -63,8 +63,8 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) { impl<'tcx> intravisit::Visitor<'tcx> for AnonConstFinder<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_anon_const(&mut self, c: &'tcx rustc_hir::AnonConst) { @@ -77,7 +77,7 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) { // the `rustc_dump_def_parents` attribute to the anon const so it would not be possible // to see what its def parent is. let mut anon_ct_finder = AnonConstFinder { tcx, anon_consts: vec![] }; - intravisit::walk_item(&mut anon_ct_finder, tcx.hir().item(iid)); + intravisit::walk_item(&mut anon_ct_finder, tcx.hir_item(iid)); for did in [did].into_iter().chain(anon_ct_finder.anon_consts) { let span = tcx.def_span(did); @@ -99,26 +99,26 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) { } pub(crate) fn vtables<'tcx>(tcx: TyCtxt<'tcx>) { - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { let def_id = id.owner_id.def_id; let Some(attr) = tcx.get_attr(def_id, sym::rustc_dump_vtable) else { continue; }; - let vtable_entries = match tcx.hir().item(id).kind { + let vtable_entries = match tcx.hir_item(id).kind { hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }) => { let trait_ref = tcx.impl_trait_ref(def_id).unwrap().instantiate_identity(); if trait_ref.has_non_region_param() { tcx.dcx().span_err( - attr.span, + attr.span(), "`rustc_dump_vtable` must be applied to non-generic impl", ); continue; } if !tcx.is_dyn_compatible(trait_ref.def_id) { tcx.dcx().span_err( - attr.span, + attr.span(), "`rustc_dump_vtable` must be applied to dyn-compatible trait", ); continue; @@ -127,7 +127,7 @@ pub(crate) fn vtables<'tcx>(tcx: TyCtxt<'tcx>) { .try_normalize_erasing_regions(ty::TypingEnv::fully_monomorphized(), trait_ref) else { tcx.dcx().span_err( - attr.span, + attr.span(), "`rustc_dump_vtable` applied to impl header that cannot be normalized", ); continue; @@ -138,7 +138,7 @@ pub(crate) fn vtables<'tcx>(tcx: TyCtxt<'tcx>) { let ty = tcx.type_of(def_id).instantiate_identity(); if ty.has_non_region_param() { tcx.dcx().span_err( - attr.span, + attr.span(), "`rustc_dump_vtable` must be applied to non-generic type", ); continue; @@ -147,13 +147,14 @@ pub(crate) fn vtables<'tcx>(tcx: TyCtxt<'tcx>) { tcx.try_normalize_erasing_regions(ty::TypingEnv::fully_monomorphized(), ty) else { tcx.dcx().span_err( - attr.span, + attr.span(), "`rustc_dump_vtable` applied to type alias that cannot be normalized", ); continue; }; let ty::Dynamic(data, _, _) = *ty.kind() else { - tcx.dcx().span_err(attr.span, "`rustc_dump_vtable` to type alias of dyn type"); + tcx.dcx() + .span_err(attr.span(), "`rustc_dump_vtable` to type alias of dyn type"); continue; }; if let Some(principal) = data.principal() { @@ -166,7 +167,7 @@ pub(crate) fn vtables<'tcx>(tcx: TyCtxt<'tcx>) { } _ => { tcx.dcx().span_err( - attr.span, + attr.span(), "`rustc_dump_vtable` only applies to impl, or type alias of dyn type", ); continue; |
