mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
Split nested_visit_mode function off from nested_visit_map
... and make the latter mandatory to implement.
This commit is contained in:
committed by
Florian Diebold
parent
725cffb1d5
commit
f0ce5bb66b
@@ -95,14 +95,13 @@ pub trait Visitor<'v> : Sized {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Nested items.
|
||||
|
||||
/// The default versions of the `visit_nested_XXX` routines invoke
|
||||
/// this method to get a map to use; if they get back `None`, they
|
||||
/// just skip nested things. Otherwise, they will lookup the
|
||||
/// nested item-like things in the map and visit it. So the best
|
||||
/// way to implement a nested visitor is to override this method
|
||||
/// to return a `Map`; one advantage of this is that if we add
|
||||
/// more types of nested things in the future, they will
|
||||
/// automatically work.
|
||||
/// The default versions of the `visit_nested_XXX` routines invoke this
|
||||
/// method to get a map to use; if they get back `None`, they just skip
|
||||
/// nested things. Otherwise, they will lookup the nested thing in the map
|
||||
/// and visit it depending on what `nested_visit_mode` returns. So the best
|
||||
/// way to implement a nested visitor is to override this method to return a
|
||||
/// `Map`; one advantage of this is that if we add more types of nested
|
||||
/// things in the future, they will automatically work.
|
||||
///
|
||||
/// **If for some reason you want the nested behavior, but don't
|
||||
/// have a `Map` are your disposal:** then you should override the
|
||||
@@ -110,8 +109,12 @@ 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) -> Option<(&Map<'v>, NestedVisitMode)> {
|
||||
None
|
||||
fn nested_visit_map(&mut self) -> Option<&Map<'v>>;
|
||||
|
||||
/// Specifies what things nested things this visitor wants to visit. By
|
||||
/// default, bodies will be visited, but not nested items.
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode {
|
||||
NestedVisitMode::OnlyBodies
|
||||
}
|
||||
|
||||
/// Invoked when a nested item is encountered. By default does
|
||||
@@ -300,16 +303,15 @@ fn visit_defaultness(&mut self, defaultness: &'v Defaultness) {
|
||||
}
|
||||
|
||||
fn map_for_body<'v, V: Visitor<'v>>(visitor: &mut V) -> Option<&Map<'v>> {
|
||||
visitor.nested_visit_map().map(|(map, _mode)| map)
|
||||
visitor.nested_visit_map()
|
||||
}
|
||||
|
||||
fn map_for_item<'v, V: Visitor<'v>>(visitor: &mut V) -> Option<&Map<'v>> {
|
||||
visitor.nested_visit_map().and_then(|(map, mode)| {
|
||||
match mode {
|
||||
NestedVisitMode::OnlyBodies => None,
|
||||
NestedVisitMode::All => Some(map)
|
||||
}
|
||||
})
|
||||
match visitor.nested_visit_mode() {
|
||||
NestedVisitMode::OnlyBodies => None,
|
||||
NestedVisitMode::All => Some(visitor.nested_visit_map()
|
||||
.expect("NestedVisitMode::All without nested_visit_map"))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_opt_name<'v, V: Visitor<'v>>(visitor: &mut V, span: Span, opt_name: Option<Name>) {
|
||||
@@ -1059,8 +1061,8 @@ pub fn result(&self) -> IdRange {
|
||||
}
|
||||
|
||||
impl<'a, 'ast> Visitor<'ast> for IdRangeComputingVisitor<'a, 'ast> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&Map<'ast>, NestedVisitMode)> {
|
||||
Some((&self.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&Map<'ast>> {
|
||||
Some(&self.map)
|
||||
}
|
||||
|
||||
fn visit_id(&mut self, id: NodeId) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
use hir::intravisit::{Visitor, NestedVisitMode};
|
||||
use hir::intravisit::Visitor;
|
||||
use hir::def_id::DefId;
|
||||
use middle::cstore::InlinedItem;
|
||||
use std::iter::repeat;
|
||||
@@ -91,7 +91,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
|
||||
/// deep walking so that we walk nested items in the context of
|
||||
/// their outer items.
|
||||
|
||||
fn nested_visit_map(&mut self) -> Option<(&map::Map<'ast>, NestedVisitMode)> {
|
||||
fn nested_visit_map(&mut self) -> Option<&map::Map<'ast>> {
|
||||
panic!("visit_nested_xxx must be manually implemented in this visitor")
|
||||
}
|
||||
|
||||
|
||||
@@ -327,6 +327,10 @@ fn visit_stmt(&mut self, stmt: &Stmt) {
|
||||
|
||||
// We walk the HIR rather than the AST when reading items from metadata.
|
||||
impl<'ast> intravisit::Visitor<'ast> for DefCollector<'ast> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn visit_body(&mut self, id: hir::ExprId) {
|
||||
if let Some(krate) = self.hir_crate {
|
||||
self.visit_expr(krate.expr(id));
|
||||
|
||||
@@ -791,8 +791,12 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, '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(&mut self) -> Option<(&hir::map::Map<'tcx>, hir_visit::NestedVisitMode)> {
|
||||
Some((&self.tcx.map, hir_visit::NestedVisitMode::All))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> hir_visit::NestedVisitMode {
|
||||
hir_visit::NestedVisitMode::All
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, it: &'tcx hir::Item) {
|
||||
@@ -1109,8 +1113,8 @@ struct IdVisitor<'a, 'b: 'a, 'tcx: 'a+'b> {
|
||||
|
||||
// Output any lints that were previously added to the session.
|
||||
impl<'a, 'b, 'tcx> hir_visit::Visitor<'tcx> for IdVisitor<'a, 'b, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, hir_visit::NestedVisitMode)> {
|
||||
Some((&self.cx.tcx.map, hir_visit::NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.cx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_id(&mut self, id: ast::NodeId) {
|
||||
|
||||
@@ -193,6 +193,8 @@ struct Formals<'a> {
|
||||
let mut formals = Formals { entry: entry, index: index };
|
||||
intravisit::walk_fn_decl(&mut formals, decl);
|
||||
impl<'a, 'v> intravisit::Visitor<'v> for Formals<'a> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_pat(&mut self, p: &hir::Pat) {
|
||||
self.index.entry(p.id).or_insert(vec![]).push(self.entry);
|
||||
intravisit::walk_pat(self, p)
|
||||
|
||||
@@ -221,8 +221,8 @@ fn visit_node(&mut self, node: &ast_map::Node<'tcx>) {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_variant_data(&mut self, def: &'tcx hir::VariantData, _: ast::Name,
|
||||
@@ -510,10 +510,12 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
|
||||
/// 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(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::All))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
if self.should_warn_about_item(item) {
|
||||
self.warn_dead_code(
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use syntax_pos::Span;
|
||||
use hir::{self, PatKind};
|
||||
use hir::def::Def;
|
||||
use hir::intravisit::{self, FnKind, Visitor, NestedVisitMode};
|
||||
use hir::intravisit::{self, FnKind, Visitor};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct UnsafeContext {
|
||||
@@ -93,8 +93,8 @@ fn require_unsafe(&mut self, span: Span, description: &str) {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for EffectCheckVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_fn(&mut self, fn_kind: FnKind<'tcx>, fn_decl: &'tcx hir::FnDecl,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use syntax::abi::Abi::RustIntrinsic;
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
use hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
|
||||
use hir::intravisit::{self, Visitor, FnKind};
|
||||
use hir;
|
||||
|
||||
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||
@@ -117,8 +117,8 @@ fn check_transmute(&self, span: Span, from: Ty<'gcx>, to: Ty<'gcx>, id: ast::Nod
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ItemVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
// const, static and N in [T; N].
|
||||
@@ -163,8 +163,8 @@ fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> Visitor<'gcx> for ExprVisitor<'a, 'gcx, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
|
||||
Some((&self.infcx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
|
||||
Some(&self.infcx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, expr: &'gcx hir::Expr) {
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
use hir::Expr;
|
||||
use hir;
|
||||
use hir::print::{expr_to_string, block_to_string};
|
||||
use hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
|
||||
use hir::intravisit::{self, Visitor, FnKind};
|
||||
|
||||
/// For use with `propagate_through_loop`.
|
||||
enum LoopKind<'a> {
|
||||
@@ -183,8 +183,8 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt) -> String {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
|
||||
b: hir::ExprId, s: Span, id: NodeId) {
|
||||
@@ -352,8 +352,8 @@ fn lnk(&self, ln: LiveNode) -> LiveNodeKind {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.ir.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.ir.tcx.map)
|
||||
}
|
||||
fn visit_fn(&mut self, _: FnKind<'tcx>, _: &'tcx hir::FnDecl,
|
||||
_: hir::ExprId, _: Span, _: NodeId) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use hir;
|
||||
use hir::intravisit::{Visitor, NestedVisitMode};
|
||||
use hir::intravisit::{Visitor};
|
||||
use hir::itemlikevisit::ItemLikeVisitor;
|
||||
use hir::intravisit;
|
||||
|
||||
@@ -89,8 +89,8 @@ struct ReachableContext<'a, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
use syntax_pos::Span;
|
||||
|
||||
use hir;
|
||||
use hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
|
||||
use hir::intravisit::{self, Visitor, FnKind};
|
||||
use hir::{Block, Item, FnDecl, Arm, Pat, PatKind, Stmt, Expr, Local};
|
||||
|
||||
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable,
|
||||
@@ -1170,8 +1170,8 @@ fn create_item_scope_if_needed(&mut self, id: ast::NodeId) {
|
||||
}
|
||||
|
||||
impl<'ast, 'a> Visitor<'ast> for RegionResolutionVisitor<'ast, 'a> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'ast>, NestedVisitMode)> {
|
||||
Some((&self.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
|
||||
Some(&self.map)
|
||||
}
|
||||
|
||||
fn visit_block(&mut self, b: &'ast Block) {
|
||||
|
||||
@@ -132,10 +132,12 @@ pub fn krate(sess: &Session,
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
// Override the nested functions -- lifetimes follow lexical scope,
|
||||
// so it's convenient to walk the tree in lexical order.
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.hir_map, NestedVisitMode::All))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.hir_map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
// Save labels for nested items.
|
||||
let saved_labels_in_fn = replace(&mut self.labels_in_fn, vec![]);
|
||||
@@ -423,6 +425,8 @@ struct GatherLabels<'a> {
|
||||
return;
|
||||
|
||||
impl<'v, 'a> Visitor<'v> for GatherLabels<'a> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_expr(&mut self, ex: &'v hir::Expr) {
|
||||
// do not recurse into closures defined in the block
|
||||
// since they are treated as separate fns from the POV of
|
||||
@@ -938,6 +942,8 @@ struct ConstrainedCollector {
|
||||
}
|
||||
|
||||
impl<'v> Visitor<'v> for ConstrainedCollector {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_ty(&mut self, ty: &'v hir::Ty) {
|
||||
match ty.node {
|
||||
hir::TyPath(hir::QPath::Resolved(Some(_), _)) |
|
||||
@@ -975,6 +981,8 @@ struct AllCollector {
|
||||
}
|
||||
|
||||
impl<'v> Visitor<'v> for AllCollector {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) {
|
||||
self.regions.insert(lifetime_ref.name);
|
||||
}
|
||||
|
||||
@@ -234,10 +234,12 @@ 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(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::All))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
|
||||
|
||||
fn visit_item(&mut self, i: &'tcx Item) {
|
||||
let orig_in_trait_impl = self.in_trait_impl;
|
||||
let mut kind = AnnotationKind::Required;
|
||||
@@ -534,10 +536,12 @@ pub fn check_stability(self, def_id: DefId, id: NodeId, span: Span) {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::OnlyBodies }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
match item.node {
|
||||
hir::ItemExternCrate(_) => {
|
||||
|
||||
@@ -125,6 +125,8 @@ fn register(&mut self, name: &str, span: Span) {
|
||||
}
|
||||
|
||||
impl<'a, 'v> Visitor<'v> for Context<'a> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_foreign_item(&mut self, i: &hir::ForeignItem) {
|
||||
if let Some(lang_item) = lang_items::extract(&i.attrs) {
|
||||
self.register(&lang_item.as_str(), i.span);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
use rustc::hir;
|
||||
use rustc::hir::Expr;
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::intravisit::{Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{Visitor};
|
||||
|
||||
use self::restrictions::RestrictionResult;
|
||||
|
||||
@@ -521,8 +521,8 @@ struct StaticInitializerCtxt<'a, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for StaticInitializerCtxt<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.bccx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.bccx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr) {
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
use errors::DiagnosticBuilder;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor, FnKind};
|
||||
|
||||
pub mod check_loans;
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator>;
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for BorrowckCtxt<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
|
||||
use rustc::hir::def::*;
|
||||
use rustc::hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor, FnKind};
|
||||
use rustc::hir::print::pat_to_string;
|
||||
use rustc::hir::{self, Pat, PatKind};
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
struct OuterVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx> }
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> { None }
|
||||
|
||||
fn visit_expr(&mut self, _expr: &'tcx hir::Expr) {
|
||||
return // const, static and N in [T; N] - shouldn't contain anything
|
||||
}
|
||||
@@ -91,8 +93,8 @@ struct MatchVisitor<'a, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for MatchVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
|
||||
@@ -561,6 +563,8 @@ struct AtBindingPatternVisitor<'a, 'b:'a, 'tcx:'b> {
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for AtBindingPatternVisitor<'a, 'b, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_pat(&mut self, pat: &Pat) {
|
||||
match pat.node {
|
||||
PatKind::Binding(.., ref subpat) => {
|
||||
|
||||
@@ -224,6 +224,8 @@ fn compute_crate_hash(&mut self) {
|
||||
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for HashItemsVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> { None }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
self.calculate_node_id(item.id, |v| v.visit_item(item));
|
||||
visit::walk_item(self, item);
|
||||
|
||||
@@ -513,9 +513,9 @@ macro_rules! hash_span {
|
||||
}
|
||||
|
||||
impl<'a, 'hash, 'tcx> visit::Visitor<'tcx> for StrictVersionHashVisitor<'a, 'hash, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, visit::NestedVisitMode)> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
if self.hash_bodies {
|
||||
Some((&self.tcx.map, visit::NestedVisitMode::OnlyBodies))
|
||||
Some(&self.tcx.map)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
use rustc::hir;
|
||||
use rustc::hir::map as ast_map;
|
||||
|
||||
use rustc::hir::intravisit::{Visitor, IdRangeComputingVisitor, IdRange, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{Visitor, IdRangeComputingVisitor, IdRange};
|
||||
|
||||
use cstore::CrateMetadata;
|
||||
use encoder::EncodeContext;
|
||||
@@ -75,8 +75,8 @@ struct SideTableEncodingIdVisitor<'a, 'b: 'a, 'tcx: 'b> {
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx> Visitor<'tcx> for SideTableEncodingIdVisitor<'a, 'b, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.ecx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.ecx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_id(&mut self, id: ast::NodeId) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
use rustc::hir::{self, PatKind};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir::intravisit::{Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{Visitor};
|
||||
use rustc::hir::intravisit;
|
||||
|
||||
use super::index_builder::{FromId, IndexBuilder, Untracked};
|
||||
@@ -983,8 +983,8 @@ struct EncodeVisitor<'a, 'b: 'a, 'tcx: 'b> {
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.index.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.index.tcx.map)
|
||||
}
|
||||
fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
|
||||
intravisit::walk_expr(self, ex);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::{self, FnKind, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, FnKind, Visitor};
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
@@ -144,8 +144,8 @@ fn build_const_integer(&mut self, expr: &'gcx hir::Expr) {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for BuildMir<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
// Const and static items.
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
use rustc::hir::{self, PatKind};
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir::intravisit::{self, FnKind, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, FnKind, Visitor};
|
||||
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::cmp::Ordering;
|
||||
@@ -233,8 +233,8 @@ fn record_borrow(&mut self, id: ast::NodeId, mutbl: hir::Mutability) {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for CheckCrateVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, i: &'tcx hir::Item) {
|
||||
|
||||
@@ -106,7 +106,7 @@ fn print(&self, title: &str) {
|
||||
}
|
||||
|
||||
impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'v>, hir_visit::NestedVisitMode)> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> {
|
||||
panic!("visit_nested_xxx must be manually implemented in this visitor")
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
use rustc::dep_graph::DepNode;
|
||||
use rustc::hir::map::Map;
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use rustc::hir;
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
@@ -60,8 +60,8 @@ pub fn check_crate(sess: &Session, map: &Map) {
|
||||
}
|
||||
|
||||
impl<'a, 'ast> Visitor<'ast> for CheckLoopVisitor<'a, 'ast> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'ast>, NestedVisitMode)> {
|
||||
Some((&self.hir_map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
|
||||
Some(&self.map)
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, i: &'ast hir::Item) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
use rustc::traits::Reveal;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
|
||||
@@ -32,8 +32,8 @@ struct RvalueContext<'a, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for RvalueContext<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_fn(&mut self,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
use syntax::ast;
|
||||
use syntax::feature_gate::{GateIssue, emit_feature_err};
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use rustc::hir;
|
||||
|
||||
use std::cell::RefCell;
|
||||
@@ -36,6 +36,8 @@ struct CheckCrateVisitor<'a, 'ast: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'ast: 'a> Visitor<'ast> for CheckCrateVisitor<'a, 'ast> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> { None }
|
||||
|
||||
fn visit_item(&mut self, it: &'ast hir::Item) {
|
||||
match it.node {
|
||||
hir::ItemStatic(..) |
|
||||
@@ -200,8 +202,8 @@ fn populate_enum_discriminants(&self, enum_definition: &'ast hir::EnumDef) {
|
||||
}
|
||||
|
||||
impl<'a, 'ast: 'a> Visitor<'ast> for CheckItemRecursionVisitor<'a, 'ast> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'ast>, NestedVisitMode)> {
|
||||
Some((&self.ast_map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
|
||||
Some(&self.ast_map)
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, it: &'ast hir::Item) {
|
||||
|
||||
@@ -120,10 +120,12 @@ fn reach<'b>(&'b mut self, item_id: ast::NodeId)
|
||||
impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, '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(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::All))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
let inherited_item_level = match item.node {
|
||||
// Impls inherit level from their types and traits
|
||||
@@ -432,10 +434,12 @@ fn check_method(&mut self, span: Span, method_def_id: DefId) {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for PrivacyVisitor<'a, '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(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::All))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
let orig_curitem = replace(&mut self.curitem, item.id);
|
||||
intravisit::walk_item(self, item);
|
||||
@@ -615,6 +619,8 @@ fn item_is_public(&self, id: &ast::NodeId, vis: &hir::Visibility) -> bool {
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_ty(&mut self, ty: &hir::Ty) {
|
||||
if let hir::TyPath(hir::QPath::Resolved(_, ref path)) = ty.node {
|
||||
if self.inner.path_is_private_type(path) {
|
||||
@@ -640,10 +646,12 @@ fn visit_expr(&mut self, _: &hir::Expr) {}
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, '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(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::All))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
match item.node {
|
||||
// contents of a private mod can be reexported, so we need
|
||||
|
||||
@@ -67,6 +67,8 @@ fn process_attrs(&mut self,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for SymbolNamesTest<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> { None }
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
self.process_attrs(item.id);
|
||||
intravisit::walk_item(self, item);
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
use syntax::util::lev_distance::find_best_match_for_name;
|
||||
use syntax_pos::{self, BytePos, Span};
|
||||
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir::{self, PatKind};
|
||||
use rustc::hir::print as pprust;
|
||||
@@ -538,8 +538,8 @@ struct CheckItemTypesVisitor<'a, 'tcx: 'a> { ccx: &'a CrateCtxt<'a, 'tcx> }
|
||||
struct CheckItemBodiesVisitor<'a, 'tcx: 'a> { ccx: &'a CrateCtxt<'a, 'tcx> }
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.ccx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.ccx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, i: &'tcx hir::Item) {
|
||||
@@ -700,6 +700,8 @@ fn assign(&mut self, _span: Span, nid: ast::NodeId, ty_opt: Option<Ty<'tcx>>) ->
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> { None }
|
||||
|
||||
// Add explicitly-declared locals.
|
||||
fn visit_local(&mut self, local: &'gcx hir::Local) {
|
||||
let o_ty = match local.ty {
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
use std::ops::Deref;
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use rustc::hir::{self, PatKind};
|
||||
|
||||
use self::SubjectNode::Subject;
|
||||
@@ -480,8 +480,8 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> {
|
||||
// hierarchy, and in particular the relationships between free
|
||||
// regions, until regionck, as described in #3238.
|
||||
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
|
||||
Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
|
||||
Some(&self.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_fn(&mut self, _fk: intravisit::FnKind<'gcx>, fd: &'gcx hir::FnDecl,
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use rustc::util::nodemap::NodeMap;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -78,8 +78,8 @@ struct SeedBorrowKind<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> Visitor<'gcx> for SeedBorrowKind<'a, 'gcx, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
|
||||
Some((&self.fcx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
|
||||
Some(&self.fcx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, expr: &'gcx hir::Expr) {
|
||||
@@ -490,8 +490,8 @@ fn adjust_closure_kind(&mut self,
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> Visitor<'gcx> for AdjustBorrowKind<'a, 'gcx, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
|
||||
Some((&self.fcx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
|
||||
Some(&self.fcx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_fn(&mut self,
|
||||
|
||||
@@ -609,6 +609,8 @@ fn reject_shadowing_type_parameters(tcx: TyCtxt, span: Span, def_id: DefId) {
|
||||
}
|
||||
|
||||
impl<'ccx, 'tcx, 'v> Visitor<'v> for CheckTypeWellFormedVisitor<'ccx, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
|
||||
|
||||
fn visit_item(&mut self, i: &hir::Item) {
|
||||
debug!("visit_item: {:?}", i);
|
||||
self.check_item_well_formed(i);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
use syntax_pos::{DUMMY_SP, Span};
|
||||
|
||||
use rustc::hir::print::pat_to_string;
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use rustc::hir::{self, PatKind};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -187,8 +187,8 @@ fn fix_scalar_binary_expr(&mut self, e: &hir::Expr) {
|
||||
// traffic in node-ids or update tables in the type context etc.
|
||||
|
||||
impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
|
||||
Some((&self.fcx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
|
||||
Some(&self.fcx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_stmt(&mut self, s: &'gcx hir::Stmt) {
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
use syntax_pos::Span;
|
||||
|
||||
use rustc::hir::{self, map as hir_map, print as pprust};
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
|
||||
use rustc::hir::intravisit::{self, Visitor};
|
||||
use rustc::hir::def::{Def, CtorKind};
|
||||
use rustc::hir::def_id::DefId;
|
||||
|
||||
@@ -178,8 +178,8 @@ fn with_collect_item_sig<OP>(&self, id: ast::NodeId, op: OP)
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
|
||||
Some((&self.ccx.tcx.map, NestedVisitMode::OnlyBodies))
|
||||
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
|
||||
Some(&self.ccx.tcx.map)
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
|
||||
Reference in New Issue
Block a user