diff options
| author | Florian Diebold <flodiebold@gmail.com> | 2016-11-24 20:15:11 +0100 |
|---|---|---|
| committer | Florian Diebold <florian.diebold@freiheit.com> | 2016-11-29 13:04:27 +0100 |
| commit | f0ce5bb66bf2ebddebbee8ae93c15c1351ea2b86 (patch) | |
| tree | 35ce5b7abead2181bebf1fb5a1a87b31ae032844 /src/librustc_const_eval | |
| parent | 725cffb1d58696e94d7a0d4fcb3b4143cfcdafd3 (diff) | |
Split nested_visit_mode function off from nested_visit_map
... and make the latter mandatory to implement.
Diffstat (limited to 'src/librustc_const_eval')
| -rw-r--r-- | src/librustc_const_eval/check_match.rs | 10 |
1 files changed, 7 insertions, 3 deletions
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) => { |
