intravisit: abstract over HIR Map
This commit is contained in:
parent
62e9ccbe28
commit
8351667091
@ -5,6 +5,7 @@
|
||||
//! item.
|
||||
|
||||
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use crate::hir::map::Map;
|
||||
use crate::lint::builtin::UNUSED_ATTRIBUTES;
|
||||
use crate::ty::query::Providers;
|
||||
use crate::ty::TyCtxt;
|
||||
@ -519,7 +520,9 @@ impl CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,6 @@
|
||||
//! This order consistency is required in a few places in rustc, for
|
||||
//! example generator inference, and possibly also HIR borrowck.
|
||||
|
||||
use crate::hir::map::Map;
|
||||
|
||||
use rustc_hir::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor};
|
||||
use rustc_hir::*;
|
||||
use rustc_span::Span;
|
||||
@ -42,10 +40,7 @@ pub struct DeepVisitor<'v, V> {
|
||||
visitor: &'v mut V,
|
||||
}
|
||||
|
||||
impl<'v, 'hir, V> DeepVisitor<'v, V>
|
||||
where
|
||||
V: Visitor<'hir> + 'v,
|
||||
{
|
||||
impl<'v, V> DeepVisitor<'v, V> {
|
||||
pub fn new(base: &'v mut V) -> Self {
|
||||
DeepVisitor { visitor: base }
|
||||
}
|
||||
@ -122,6 +117,14 @@ impl<'a> FnKind<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// An abstract representation of the HIR `rustc::hir::map::Map`.
|
||||
pub trait Map<'hir> {
|
||||
fn body(&self, id: BodyId) -> &'hir Body<'hir>;
|
||||
fn item(&self, id: HirId) -> &'hir Item<'hir>;
|
||||
fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir>;
|
||||
fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir>;
|
||||
}
|
||||
|
||||
/// Specifies what nested things a visitor wants to visit. The most
|
||||
/// common choice is `OnlyBodies`, which will cause the visitor to
|
||||
/// visit fn bodies for fns that it encounters, but skip over nested
|
||||
@ -129,7 +132,7 @@ impl<'a> FnKind<'a> {
|
||||
///
|
||||
/// See the comments on `ItemLikeVisitor` for more details on the overall
|
||||
/// visit strategy.
|
||||
pub enum NestedVisitorMap<'this, 'tcx> {
|
||||
pub enum NestedVisitorMap<'this, M> {
|
||||
/// Do not visit any nested things. When you add a new
|
||||
/// "non-nested" thing, you will want to audit such uses to see if
|
||||
/// they remain valid.
|
||||
@ -146,20 +149,20 @@ pub enum NestedVisitorMap<'this, 'tcx> {
|
||||
/// to use `visit_all_item_likes()` as an outer loop,
|
||||
/// and to have the visitor that visits the contents of each item
|
||||
/// using this setting.
|
||||
OnlyBodies(&'this Map<'tcx>),
|
||||
OnlyBodies(&'this M),
|
||||
|
||||
/// Visits all nested things, including item-likes.
|
||||
///
|
||||
/// **This is an unusual choice.** It is used when you want to
|
||||
/// process everything within their lexical context. Typically you
|
||||
/// kick off the visit by doing `walk_krate()`.
|
||||
All(&'this Map<'tcx>),
|
||||
All(&'this M),
|
||||
}
|
||||
|
||||
impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> {
|
||||
impl<'this, M> NestedVisitorMap<'this, M> {
|
||||
/// Returns the map to use for an "intra item-like" thing (if any).
|
||||
/// E.g., function body.
|
||||
fn intra(self) -> Option<&'this Map<'tcx>> {
|
||||
fn intra(self) -> Option<&'this M> {
|
||||
match self {
|
||||
NestedVisitorMap::None => None,
|
||||
NestedVisitorMap::OnlyBodies(map) => Some(map),
|
||||
@ -169,7 +172,7 @@ impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> {
|
||||
|
||||
/// Returns the map to use for an "item-like" thing (if any).
|
||||
/// E.g., item, impl-item.
|
||||
fn inter(self) -> Option<&'this Map<'tcx>> {
|
||||
fn inter(self) -> Option<&'this M> {
|
||||
match self {
|
||||
NestedVisitorMap::None => None,
|
||||
NestedVisitorMap::OnlyBodies(_) => None,
|
||||
@ -195,6 +198,8 @@ impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> {
|
||||
/// to monitor future changes to `Visitor` in case a new method with a
|
||||
/// new default implementation gets introduced.)
|
||||
pub trait Visitor<'v>: Sized {
|
||||
type Map: Map<'v>;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Nested items.
|
||||
|
||||
@ -214,7 +219,7 @@ pub trait Visitor<'v>: Sized {
|
||||
/// `panic!()`. This way, if a new `visit_nested_XXX` variant is
|
||||
/// added in the future, we will see the panic in your code and
|
||||
/// fix it appropriately.
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, 'v>;
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map>;
|
||||
|
||||
/// Invoked when a nested item is encountered. By default does
|
||||
/// nothing unless you override `nested_visit_map` to return other than
|
||||
@ -496,21 +501,16 @@ pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_poly_trait_ref<'v, V>(
|
||||
pub fn walk_poly_trait_ref<'v, V: Visitor<'v>>(
|
||||
visitor: &mut V,
|
||||
trait_ref: &'v PolyTraitRef<'v>,
|
||||
_modifier: TraitBoundModifier,
|
||||
) where
|
||||
V: Visitor<'v>,
|
||||
{
|
||||
) {
|
||||
walk_list!(visitor, visit_generic_param, trait_ref.bound_generic_params);
|
||||
visitor.visit_trait_ref(&trait_ref.trait_ref);
|
||||
}
|
||||
|
||||
pub fn walk_trait_ref<'v, V>(visitor: &mut V, trait_ref: &'v TraitRef<'v>)
|
||||
where
|
||||
V: Visitor<'v>,
|
||||
{
|
||||
pub fn walk_trait_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_ref: &'v TraitRef<'v>) {
|
||||
visitor.visit_id(trait_ref.hir_ref_id);
|
||||
visitor.visit_path(&trait_ref.path, trait_ref.hir_ref_id)
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::dep_graph::{DepGraph, DepKind, DepNode, DepNodeIndex};
|
||||
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use crate::hir::map::definitions::{self, DefPathHash};
|
||||
use crate::hir::map::{Entry, HirEntryMap};
|
||||
use crate::hir::map::{Entry, HirEntryMap, Map};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::middle::cstore::CrateStore;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
@ -336,11 +336,13 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
||||
}
|
||||
|
||||
impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
|
||||
type Map = Map<'hir>;
|
||||
|
||||
/// 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<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
panic!("`visit_nested_xxx` must be manually implemented in this visitor");
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,9 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
|
||||
}
|
||||
|
||||
impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'hir> {
|
||||
type Map = Map<'hir>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
|
||||
intravisit::NestedVisitorMap::OnlyBodies(self.hir_map)
|
||||
}
|
||||
|
||||
|
@ -1093,6 +1093,24 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'hir> intravisit::Map<'hir> for Map<'hir> {
|
||||
fn body(&self, id: BodyId) -> &'hir Body<'hir> {
|
||||
self.body(id)
|
||||
}
|
||||
|
||||
fn item(&self, id: HirId) -> &'hir Item<'hir> {
|
||||
self.item(id)
|
||||
}
|
||||
|
||||
fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir> {
|
||||
self.trait_item(id)
|
||||
}
|
||||
|
||||
fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir> {
|
||||
self.impl_item(id)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct NodesMatchingSuffix<'a> {
|
||||
map: &'a Map<'a>,
|
||||
item_name: &'a String,
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! Upvar (closure capture) collection from cross-body HIR uses of `Res::Local`s.
|
||||
|
||||
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use crate::hir::map::Map;
|
||||
use crate::ty::query::Providers;
|
||||
use crate::ty::TyCtxt;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
@ -43,7 +44,9 @@ struct LocalCollector {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for LocalCollector {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -70,7 +73,9 @@ impl CaptureCollector<'_, '_> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,9 @@ impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for FindLocalByTypeVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.hir_map)
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use crate::hir::map::Map;
|
||||
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
|
||||
use crate::middle::resolve_lifetime as rl;
|
||||
use crate::ty::{self, Region, TyCtxt};
|
||||
@ -90,7 +91,9 @@ struct FindNestedTypeVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -207,7 +210,9 @@ struct TyPathVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for TyPathVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Map<'tcx>> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ use crate::session::config;
|
||||
|
||||
use crate::hir::intravisit;
|
||||
use crate::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||
use crate::hir::map::Map;
|
||||
use crate::ty::TyCtxt;
|
||||
use errors::struct_span_err;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
@ -136,7 +137,9 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Map<'v>> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,8 @@
|
||||
use rustc::arena::Arena;
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map::{DefKey, DefPathData, Definitions};
|
||||
use rustc::hir::map::definitions::{DefKey, DefPathData, Definitions};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint;
|
||||
use rustc::lint::builtin::{self, ELIDED_LIFETIMES_IN_PATHS};
|
||||
use rustc::middle::cstore::CrateStore;
|
||||
@ -1484,7 +1485,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
}
|
||||
|
||||
impl<'r, 'a, 'v, 'hir> intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ use graphviz as dot;
|
||||
use rustc::dep_graph::debug::{DepNodeFilter, EdgeFilter};
|
||||
use rustc::dep_graph::{DepGraphQuery, DepKind, DepNode};
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING};
|
||||
@ -159,7 +160,9 @@ impl IfThisChanged<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for IfThisChanged<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
use rustc::dep_graph::{label_strs, DepNode};
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
@ -547,7 +548,9 @@ impl FindAllAttrs<'tcx> {
|
||||
}
|
||||
|
||||
impl intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
|
||||
intravisit::NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ use std::fmt::Write;
|
||||
|
||||
use lint::{EarlyContext, EarlyLintPass, LateLintPass, LintPass};
|
||||
use lint::{LateContext, LintArray, LintContext};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint;
|
||||
use rustc::lint::FutureIncompatibleInfo;
|
||||
use rustc::traits::misc::can_type_implement_copy;
|
||||
@ -1093,7 +1094,9 @@ impl TypeAliasBounds {
|
||||
err: &'a mut DiagnosticBuilder<'db>,
|
||||
}
|
||||
impl<'a, 'db, 'v> Visitor<'v> for WalkAssocTypes<'a, 'db> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
use rustc::hir::intravisit as hir_visit;
|
||||
use rustc::hir::intravisit::Visitor;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint::LateContext;
|
||||
use rustc::lint::LintPass;
|
||||
use rustc::lint::{LateLintPass, LateLintPassObject};
|
||||
@ -86,10 +87,12 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> LateContextAndPass<'a, 'tcx, T> {
|
||||
impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> hir_visit::Visitor<'tcx>
|
||||
for LateContextAndPass<'a, 'tcx, T>
|
||||
{
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
/// Because lints are scoped lexically, we want to walk nested
|
||||
/// items in the context of the outer item, so enable
|
||||
/// deep-walking.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this, Self::Map> {
|
||||
hir_visit::NestedVisitorMap::All(&self.context.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint::{LintLevelMap, LintLevelSets, LintLevelsBuilder, LintStore};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::TyCtxt;
|
||||
@ -50,7 +51,9 @@ impl LintLevelMapBuilder<'_, '_> {
|
||||
}
|
||||
|
||||
impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
|
||||
intravisit::NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ use crate::rmeta::table::FixedSizeEncoding;
|
||||
use crate::rmeta::*;
|
||||
|
||||
use rustc::hir::map::definitions::DefPathTable;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::middle::cstore::{EncodedMetadata, ForeignModule, LinkagePreference, NativeLibrary};
|
||||
use rustc::middle::dependency_format::Linkage;
|
||||
use rustc::middle::exported_symbols::{metadata_symbol_name, ExportedSymbol, SymbolExportLevel};
|
||||
@ -1520,7 +1521,9 @@ impl EncodeContext<'tcx> {
|
||||
|
||||
// FIXME(eddyb) make metadata encoding walk over all definitions, instead of HIR.
|
||||
impl Visitor<'tcx> for EncodeContext<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
|
||||
|
@ -5,6 +5,7 @@ use super::_match::{expand_pattern, is_useful, MatchCheckCtxt, Matrix, PatStack}
|
||||
use super::{PatCtxt, PatKind, PatternError};
|
||||
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint;
|
||||
use rustc::session::Session;
|
||||
use rustc::ty::subst::{InternalSubsts, SubstsRef};
|
||||
@ -49,7 +50,9 @@ struct MatchVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -730,7 +733,9 @@ fn check_legality_of_bindings_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pa
|
||||
}
|
||||
|
||||
impl<'v> Visitor<'v> for AtBindingPatternVisitor<'_, '_, '_> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint::builtin::{SAFE_PACKED_BORROWS, UNUSED_UNSAFE};
|
||||
use rustc::mir::visit::{MutatingUseContext, PlaceContext, Visitor};
|
||||
use rustc::mir::*;
|
||||
@ -475,7 +476,9 @@ struct UnusedUnsafeVisitor<'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::{build, shim};
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::mir::{BodyAndCache, ConstQualifs, MirPhase, Promoted};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::steal::Steal;
|
||||
@ -85,7 +86,8 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
|
||||
}
|
||||
intravisit::walk_struct_def(self, v)
|
||||
}
|
||||
fn nested_visit_map<'b>(&'b mut self) -> NestedVisitorMap<'b, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
fn nested_visit_map<'b>(&'b mut self) -> NestedVisitorMap<'b, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,9 @@ impl<'tcx> CheckConstVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
// from live codes are live, and everything else is dead.
|
||||
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint;
|
||||
use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc::middle::privacy;
|
||||
@ -210,7 +211,9 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -563,11 +566,13 @@ impl DeadVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for DeadVisitor<'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
/// Walk nested items in place so that we don't report dead-code
|
||||
/// on inner functions when the outer function is already getting
|
||||
/// an error. We could do this also by checking the parents, but
|
||||
/// this is how the code is setup and it seems harmless enough.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
// completely accurate (some things might be counted twice, others missed).
|
||||
|
||||
use rustc::hir::intravisit as hir_visit;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::util::common::to_readable_str;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir as hir;
|
||||
@ -92,7 +93,9 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
hir_visit::walk_param(self, param)
|
||||
}
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> hir_visit::NestedVisitorMap<'_, Self::Map> {
|
||||
panic!("visit_nested_xxx must be manually implemented in this visitor")
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
use errors::struct_span_err;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::ty::layout::{LayoutError, Pointer, SizeSkeleton, VariantIdx};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc_hir as hir;
|
||||
use rustc_index::vec::Idx;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_target::spec::abi::Abi::RustIntrinsic;
|
||||
@ -124,7 +124,9 @@ impl ExprVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for ItemVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -139,7 +141,9 @@ impl Visitor<'tcx> for ItemVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for ExprVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
use errors::struct_span_err;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::middle::lib_features::LibFeatures;
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::TyCtxt;
|
||||
@ -113,7 +114,9 @@ impl LibFeatureCollector<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ use self::VarKind::*;
|
||||
|
||||
use errors::Applicability;
|
||||
use rustc::hir::intravisit::{self, FnKind, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint;
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
@ -153,7 +154,9 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String {
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -1348,7 +1351,9 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
// Checking for error conditions
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,9 @@ pub(crate) fn provide(providers: &mut Providers<'_>) {
|
||||
}
|
||||
|
||||
impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> {
|
||||
type Map = Map<'hir>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.hir_map)
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
|
||||
use rustc::middle::privacy;
|
||||
use rustc::session::config;
|
||||
@ -82,7 +83,9 @@ struct ReachableContext<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
//! [rustc guide]: https://rust-lang.github.io/rustc-guide/mir/borrowck.html
|
||||
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::middle::region::*;
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::TyCtxt;
|
||||
@ -695,7 +696,9 @@ impl<'tcx> RegionResolutionVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
use errors::struct_span_err;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint;
|
||||
use rustc::middle::privacy::AccessLevels;
|
||||
use rustc::middle::stability::{DeprecationEntry, Index};
|
||||
@ -204,7 +205,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||
/// Because stability levels are scoped lexically, we want to walk
|
||||
/// nested items in the context of the outer item, so enable
|
||||
/// deep-walking.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -293,7 +296,9 @@ impl<'a, 'tcx> MissingStabilityAnnotations<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -429,10 +434,12 @@ struct Checker<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for Checker<'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
/// Because stability levels are scoped lexically, we want to walk
|
||||
/// nested items in the context of the outer item, so enable
|
||||
/// deep-walking.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
use rustc::bug;
|
||||
use rustc::hir::intravisit::{self, DeepVisitor, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::lint;
|
||||
use rustc::middle::privacy::{AccessLevel, AccessLevels};
|
||||
use rustc::ty::fold::TypeVisitor;
|
||||
@ -372,7 +373,9 @@ struct PubRestrictedVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
fn visit_vis(&mut self, vis: &'tcx hir::Visibility<'tcx>) {
|
||||
@ -670,9 +673,11 @@ impl EmbargoVisitor<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
/// We want to visit items in the context of their containing
|
||||
/// module and so forth, so supply a crate for doing a deep walk.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -1039,9 +1044,11 @@ impl<'a, 'tcx> NamePrivacyVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
/// We want to visit items in the context of their containing
|
||||
/// module and so forth, so supply a crate for doing a deep walk.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -1179,9 +1186,11 @@ impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
/// We want to visit items in the context of their containing
|
||||
/// module and so forth, so supply a crate for doing a deep walk.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -1437,7 +1446,9 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -1463,9 +1474,11 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
/// We want to visit items in the context of their containing
|
||||
/// module and so forth, so supply a crate for doing a deep walk.
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -1906,7 +1919,9 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,9 @@ fn sub_items_have_self_param(node: &hir::ItemKind<'_>) -> bool {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -1086,7 +1088,9 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body<'_>) {
|
||||
gather.visit_body(body);
|
||||
|
||||
impl<'v, 'a, 'tcx> Visitor<'v> for GatherLabels<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -2129,7 +2133,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a> Visitor<'a> for SelfVisitor<'a> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'a> {
|
||||
type Map = Map<'a>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -2217,7 +2223,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'v, 'a> Visitor<'v> for GatherLifetimes<'a> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -2802,7 +2810,9 @@ fn insert_late_bound_lifetimes(
|
||||
}
|
||||
|
||||
impl<'v> Visitor<'v> for ConstrainedCollector {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -2843,7 +2853,9 @@ fn insert_late_bound_lifetimes(
|
||||
}
|
||||
|
||||
impl<'v> Visitor<'v> for AllCollector {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ mod environment;
|
||||
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::definitions::DefPathData;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::traits::{
|
||||
Clause, Clauses, DomainGoal, FromEnv, GoalKind, PolyDomainGoal, ProgramClause,
|
||||
ProgramClauseCategory, WellFormed, WhereClause,
|
||||
@ -600,7 +601,9 @@ impl ClauseDumper<'tcx> {
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for ClauseDumper<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
use errors::{pluralize, struct_span_err, Applicability, DiagnosticId};
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::infer::{self, InferOk};
|
||||
use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal};
|
||||
use rustc::ty::error::{ExpectedFound, TypeError};
|
||||
@ -890,9 +891,10 @@ fn compare_synthetic_generics<'tcx>(
|
||||
}
|
||||
}
|
||||
}
|
||||
fn nested_visit_map<'this>(
|
||||
&'this mut self,
|
||||
) -> intravisit::NestedVisitorMap<'this, 'v>
|
||||
type Map = Map<'v>;
|
||||
fn nested_visit_map(
|
||||
&mut self,
|
||||
) -> intravisit::NestedVisitorMap<'_, Self::Map>
|
||||
{
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
use super::FnCtxt;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::middle::region::{self, YieldData};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
@ -193,7 +194,9 @@ pub fn resolve_interior<'a, 'tcx>(
|
||||
// librustc/middle/region.rs since `expr_count` is compared against the results
|
||||
// there.
|
||||
impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ use crate::namespace::Namespace;
|
||||
use errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder};
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map as hir_map;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::traits::Obligation;
|
||||
use rustc::ty::print::with_crate_prefix;
|
||||
@ -1124,7 +1125,9 @@ impl intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ use crate::middle::lang_items;
|
||||
use crate::namespace::Namespace;
|
||||
use errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder, DiagnosticId};
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse};
|
||||
use rustc::infer::error_reporting::TypeAnnotationNeeded::E0282;
|
||||
use rustc::infer::opaque_types::OpaqueTypeDecl;
|
||||
@ -1170,7 +1171,9 @@ impl<'a, 'tcx> GatherLocalsVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,7 @@ use crate::check::FnCtxt;
|
||||
use crate::mem_categorization as mc;
|
||||
use crate::middle::region;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::infer::outlives::env::OutlivesEnvironment;
|
||||
use rustc::infer::{self, RegionObligation, SuppressRegionErrors};
|
||||
use rustc::ty::adjustment;
|
||||
@ -414,7 +415,9 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> {
|
||||
// hierarchy, and in particular the relationships between free
|
||||
// regions, until regionck, as described in #3238.
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ use crate::expr_use_visitor as euv;
|
||||
use crate::mem_categorization as mc;
|
||||
use crate::mem_categorization::PlaceBase;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::infer::UpvarRegion;
|
||||
use rustc::ty::{self, Ty, TyCtxt, UpvarSubsts};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
@ -59,7 +60,9 @@ struct InferBorrowKindVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for InferBorrowKindVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
use crate::check::FnCtxt;
|
||||
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::infer::error_reporting::TypeAnnotationNeeded::E0282;
|
||||
use rustc::infer::InferCtxt;
|
||||
use rustc::ty::adjustment::{Adjust, Adjustment, PointerCast};
|
||||
@ -242,7 +243,9 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
// traffic in node-ids or update tables in the type context etc.
|
||||
|
||||
impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ use crate::middle::resolve_lifetime as rl;
|
||||
use crate::middle::weak_lang_items;
|
||||
use errors::{struct_span_err, Applicability, StashKey};
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
|
||||
use rustc::mir::mono::Linkage;
|
||||
use rustc::traits;
|
||||
@ -104,7 +105,9 @@ pub struct ItemCtxt<'tcx> {
|
||||
crate struct PlaceholderHirTyCollector(crate Vec<Span>);
|
||||
|
||||
impl<'v> Visitor<'v> for PlaceholderHirTyCollector {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
type Map = Map<'v>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
fn visit_ty(&mut self, t: &'v hir::Ty<'v>) {
|
||||
@ -185,7 +188,9 @@ fn reject_placeholder_type_signatures_in_item(tcx: TyCtxt<'tcx>, item: &'tcx hir
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
||||
}
|
||||
|
||||
@ -885,7 +890,9 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
||||
}
|
||||
|
||||
impl Visitor<'tcx> for LateBoundRegionsDetector<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
@ -1715,7 +1722,9 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
}
|
||||
|
||||
impl<'tcx> intravisit::Visitor<'tcx> for ConstraintLocator<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
|
||||
type Map = Map<'tcx>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
||||
intravisit::NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
fn visit_item(&mut self, it: &'tcx Item<'tcx>) {
|
||||
|
@ -899,7 +899,9 @@ impl<'a, 'hir> HirCollector<'a, 'hir> {
|
||||
}
|
||||
|
||||
impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'hir> {
|
||||
type Map = Map<'hir>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
||||
intravisit::NestedVisitorMap::All(&self.map)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user