Replace NestedVisitorMap with NestedFilter
This commit is contained in:
parent
bd3cb52565
commit
45db716902
57 changed files with 258 additions and 512 deletions
|
@ -14,10 +14,11 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{DefIdMap, LocalDefId};
|
||||
use rustc_hir::hir_id::ItemLocalId;
|
||||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{GenericArg, GenericParam, LifetimeName, Node, ParamName, QPath};
|
||||
use rustc_hir::{GenericParamKind, HirIdMap, HirIdSet, LifetimeParamKind};
|
||||
use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::middle::resolve_lifetime::*;
|
||||
use rustc_middle::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
|
@ -651,10 +652,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
type NestedFilter = nested_filter::All;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||
NestedVisitorMap::All(self.tcx.hir())
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
self.tcx.hir()
|
||||
}
|
||||
|
||||
// We want to nest trait/impl items in their parent, but nothing else.
|
||||
|
@ -1613,12 +1614,6 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body<'_>) {
|
|||
gather.visit_body(body);
|
||||
|
||||
impl<'v, 'a, 'tcx> Visitor<'v> for GatherLabels<'a, 'tcx> {
|
||||
type Map = intravisit::ErasedMap<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, ex: &hir::Expr<'_>) {
|
||||
if let Some(label) = expression_label(ex) {
|
||||
for prior_label in &self.labels_in_fn[..] {
|
||||
|
@ -2832,12 +2827,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'a> Visitor<'a> for SelfVisitor<'a> {
|
||||
type Map = intravisit::ErasedMap<'a>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: &'a hir::Ty<'a>) {
|
||||
if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.kind {
|
||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.kind
|
||||
|
@ -2922,12 +2911,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'v, 'a> Visitor<'v> for GatherLifetimes<'a> {
|
||||
type Map = intravisit::ErasedMap<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: &hir::Ty<'_>) {
|
||||
if let hir::TyKind::BareFn(_) = ty.kind {
|
||||
self.outer_index.shift_in(1);
|
||||
|
@ -3005,12 +2988,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
anon_count: u32,
|
||||
}
|
||||
impl<'v> Visitor<'v> for GatherAnonLifetimes {
|
||||
type Map = intravisit::ErasedMap<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
#[instrument(skip(self), level = "trace")]
|
||||
fn visit_ty(&mut self, ty: &hir::Ty<'_>) {
|
||||
// If we enter a `BareFn`, then we enter a *new* binding scope
|
||||
|
@ -3508,12 +3485,6 @@ fn insert_late_bound_lifetimes(
|
|||
}
|
||||
|
||||
impl<'v> Visitor<'v> for ConstrainedCollector {
|
||||
type Map = intravisit::ErasedMap<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: &'v hir::Ty<'v>) {
|
||||
match ty.kind {
|
||||
hir::TyKind::Path(
|
||||
|
@ -3552,12 +3523,6 @@ fn insert_late_bound_lifetimes(
|
|||
}
|
||||
|
||||
impl<'v> Visitor<'v> for AllCollector {
|
||||
type Map = intravisit::ErasedMap<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) {
|
||||
self.regions.insert(lifetime_ref.name.normalize_to_macros_2_0());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue