@@ -29,7 +29,7 @@ use rustc::ty::{self, TyCtxt};
29
29
use rustc_errors:: DiagnosticBuilder ;
30
30
31
31
use rustc:: hir:: def:: * ;
32
- use rustc:: hir:: intravisit:: { self , Visitor , FnKind } ;
32
+ use rustc:: hir:: intravisit:: { self , Visitor , FnKind , NestedVisitMode } ;
33
33
use rustc:: hir:: print:: pat_to_string;
34
34
use rustc:: hir:: { self , Pat , PatKind } ;
35
35
@@ -41,29 +41,29 @@ use syntax_pos::Span;
41
41
42
42
struct OuterVisitor < ' a , ' tcx : ' a > { tcx : TyCtxt < ' a , ' tcx , ' tcx > }
43
43
44
- impl < ' a , ' v , ' tcx > Visitor < ' v > for OuterVisitor < ' a , ' tcx > {
45
- fn visit_expr ( & mut self , _expr : & hir:: Expr ) {
44
+ impl < ' a , ' tcx > Visitor < ' tcx > for OuterVisitor < ' a , ' tcx > {
45
+ fn visit_expr ( & mut self , _expr : & ' tcx hir:: Expr ) {
46
46
return // const, static and N in [T; N] - shouldn't contain anything
47
47
}
48
48
49
- fn visit_trait_item ( & mut self , item : & hir:: TraitItem ) {
49
+ fn visit_trait_item ( & mut self , item : & ' tcx hir:: TraitItem ) {
50
50
if let hir:: ConstTraitItem ( ..) = item. node {
51
51
return // nothing worth match checking in a constant
52
52
} else {
53
53
intravisit:: walk_trait_item ( self , item) ;
54
54
}
55
55
}
56
56
57
- fn visit_impl_item ( & mut self , item : & hir:: ImplItem ) {
57
+ fn visit_impl_item ( & mut self , item : & ' tcx hir:: ImplItem ) {
58
58
if let hir:: ImplItemKind :: Const ( ..) = item. node {
59
59
return // nothing worth match checking in a constant
60
60
} else {
61
61
intravisit:: walk_impl_item ( self , item) ;
62
62
}
63
63
}
64
64
65
- fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v hir:: FnDecl ,
66
- b : & ' v hir:: Expr , s : Span , id : ast:: NodeId ) {
65
+ fn visit_fn ( & mut self , fk : FnKind < ' tcx > , fd : & ' tcx hir:: FnDecl ,
66
+ b : hir:: ExprId , s : Span , id : ast:: NodeId ) {
67
67
if let FnKind :: Closure ( ..) = fk {
68
68
span_bug ! ( s, "check_match: closure outside of function" )
69
69
}
@@ -90,8 +90,12 @@ struct MatchVisitor<'a, 'tcx: 'a> {
90
90
param_env : & ' a ty:: ParameterEnvironment < ' tcx >
91
91
}
92
92
93
- impl < ' a , ' tcx , ' v > Visitor < ' v > for MatchVisitor < ' a , ' tcx > {
94
- fn visit_expr ( & mut self , ex : & hir:: Expr ) {
93
+ impl < ' a , ' tcx > Visitor < ' tcx > for MatchVisitor < ' a , ' tcx > {
94
+ fn nested_visit_map ( & mut self ) -> Option < ( & hir:: map:: Map < ' tcx > , NestedVisitMode ) > {
95
+ Some ( ( & self . tcx . map , NestedVisitMode :: OnlyBodies ) )
96
+ }
97
+
98
+ fn visit_expr ( & mut self , ex : & ' tcx hir:: Expr ) {
95
99
intravisit:: walk_expr ( self , ex) ;
96
100
97
101
match ex. node {
@@ -102,7 +106,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MatchVisitor<'a, 'tcx> {
102
106
}
103
107
}
104
108
105
- fn visit_local ( & mut self , loc : & hir:: Local ) {
109
+ fn visit_local ( & mut self , loc : & ' tcx hir:: Local ) {
106
110
intravisit:: walk_local ( self , loc) ;
107
111
108
112
self . check_irrefutable ( & loc. pat , false ) ;
@@ -111,8 +115,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MatchVisitor<'a, 'tcx> {
111
115
self . check_patterns ( false , slice:: ref_slice ( & loc. pat ) ) ;
112
116
}
113
117
114
- fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v hir:: FnDecl ,
115
- b : & ' v hir:: Expr , s : Span , n : ast:: NodeId ) {
118
+ fn visit_fn ( & mut self , fk : FnKind < ' tcx > , fd : & ' tcx hir:: FnDecl ,
119
+ b : hir:: ExprId , s : Span , n : ast:: NodeId ) {
116
120
intravisit:: walk_fn ( self , fk, fd, b, s, n) ;
117
121
118
122
for input in & fd. inputs {
0 commit comments