From f0ce5bb66bf2ebddebbee8ae93c15c1351ea2b86 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 24 Nov 2016 20:15:11 +0100 Subject: Split nested_visit_mode function off from nested_visit_map ... and make the latter mandatory to implement. --- src/librustc_const_eval/check_match.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/librustc_const_eval') diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index 6862518067c..08116327590 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -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) => { -- cgit 1.4.1-3-g733a5