Split nested_visit_mode function off from nested_visit_map
... and make the latter mandatory to implement.
This commit is contained in:
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 @@ pub trait Visitor<'v> : Sized {
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'ast> IdRangeComputingVisitor<'a, 'ast> {
|
||||
}
|
||||
|
||||
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 @@ impl<'a> visit::Visitor for DefCollector<'a> {
|
||||
|
||||
// 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 @@ fn build_nodeid_to_index(decl: Option<&hir::FnDecl>,
|
||||
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 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, '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::ast;
|
||||
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 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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 ty::layout::{LayoutError, Pointer, SizeSkeleton};
|
||||
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 @@ impl<'a, 'gcx, 'tcx> ExprVisitor<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'tcx> Visitor<'tcx> for ItemVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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 syntax_pos::Span;
|
||||
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 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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::abi::Abi;
|
||||
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::ast::{self, NodeId};
|
||||
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 @@ impl<'ast, 'a> RegionResolutionVisitor<'ast, 'a> {
|
||||
}
|
||||
|
||||
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 @@ fn extract_labels(ctxt: &mut LifetimeContext, b: hir::ExprId) {
|
||||
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 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
|
||||
}
|
||||
|
||||
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 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
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 @@ impl<'a> Context<'a> {
|
||||
}
|
||||
|
||||
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 syntax_pos::Span;
|
||||
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 syntax_pos::{MultiSpan, Span};
|
||||
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 struct LoanDataFlowOperator;
|
||||
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::ty::{self, TyCtxt};
|
||||
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 @@ use syntax_pos::Span;
|
||||
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 @@ impl<'a, 'tcx> HashItemsVisitor<'a, 'tcx> {
|
||||
|
||||
|
||||
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 syntax_pos;
|
||||
|
||||
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::traits::Reveal;
|
||||
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 @@ impl<'a, 'gcx> BuildMir<'a, 'gcx> {
|
||||
}
|
||||
|
||||
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::lint::builtin::CONST_ERR;
|
||||
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 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> {
|
||||
}
|
||||
|
||||
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 @@ impl<'k> StatCollector<'k> {
|
||||
}
|
||||
|
||||
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::session::Session;
|
||||
|
||||
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::ty::{self, TyCtxt, ParameterEnvironment};
|
||||
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 rustc::util::nodemap::NodeMap;
|
||||
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 @@ impl<'a, 'ast: 'a> CheckItemRecursionVisitor<'a, 'ast> {
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> {
|
||||
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 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
||||
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 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a
|
||||
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 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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::symbol::{Symbol, InternedString, keywords};
|
||||
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 @@ impl<'a, 'gcx, 'tcx> GatherLocalsVisitor<'a, 'gcx, '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::mem;
|
||||
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 rustc::infer::UpvarRegion;
|
||||
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 @@ impl<'a, 'gcx, 'tcx> AdjustBorrowKind<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
|
||||
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::ast;
|
||||
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 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
|
||||
// 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::symbol::{Symbol, keywords};
|
||||
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 @@ impl<'a, 'tcx> CollectItemTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user