1
Fork 0

Replace NestedVisitorMap with NestedFilter

This commit is contained in:
Cameron Steffen 2021-11-03 18:03:12 -05:00
parent bd3cb52565
commit 45db716902
57 changed files with 258 additions and 512 deletions

View file

@ -3,7 +3,7 @@ use rustc_data_structures::sorted_map::SortedMap;
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::definitions;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::*;
use rustc_index::vec::{Idx, IndexVec};
use rustc_session::Session;
@ -101,16 +101,10 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
}
impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
type Map = !;
/// Because we want to track parent items and so forth, enable
/// deep walking so that we walk nested items in the context of
/// their outer items.
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
panic!("`visit_nested_xxx` must be manually implemented in this visitor");
}
fn visit_nested_item(&mut self, item: ItemId) {
debug!("visit_nested_item: {:?}", item);
self.insert_nested(item.def_id);

View file

@ -2436,12 +2436,6 @@ fn lifetimes_from_impl_trait_bounds(
}
impl<'r, 'v> intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r> {
type Map = intravisit::ErasedMap<'v>;
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
intravisit::NestedVisitorMap::None
}
fn visit_generic_args(&mut self, span: Span, parameters: &'v hir::GenericArgs<'v>) {
// Don't collect elided lifetimes used inside of `Fn()` syntax.
if parameters.parenthesized {