@@ -75,11 +75,11 @@ enum LetSource {
75
75
WhileLet ,
76
76
}
77
77
78
- struct MatchVisitor < ' thir , ' p , ' tcx > {
78
+ struct MatchVisitor < ' p , ' tcx > {
79
79
tcx : TyCtxt < ' tcx > ,
80
80
param_env : ty:: ParamEnv < ' tcx > ,
81
81
typeck_results : & ' tcx ty:: TypeckResults < ' tcx > ,
82
- thir : & ' thir Thir < ' tcx > ,
82
+ thir : & ' p Thir < ' tcx > ,
83
83
lint_level : HirId ,
84
84
let_source : LetSource ,
85
85
pattern_arena : & ' p TypedArena < DeconstructedPat < ' p , ' tcx > > ,
@@ -92,13 +92,13 @@ struct MatchVisitor<'thir, 'p, 'tcx> {
92
92
93
93
// Visitor for a thir body. This calls `check_match`, `check_let` and `check_let_chain` as
94
94
// appropriate.
95
- impl < ' thir , ' tcx > Visitor < ' thir , ' tcx > for MatchVisitor < ' thir , ' _ , ' tcx > {
96
- fn thir ( & self ) -> & ' thir Thir < ' tcx > {
95
+ impl < ' p , ' tcx > Visitor < ' p , ' tcx > for MatchVisitor < ' p , ' tcx > {
96
+ fn thir ( & self ) -> & ' p Thir < ' tcx > {
97
97
self . thir
98
98
}
99
99
100
100
#[ instrument( level = "trace" , skip( self ) ) ]
101
- fn visit_arm ( & mut self , arm : & Arm < ' tcx > ) {
101
+ fn visit_arm ( & mut self , arm : & ' p Arm < ' tcx > ) {
102
102
self . with_lint_level ( arm. lint_level , |this| {
103
103
match arm. guard {
104
104
Some ( Guard :: If ( expr) ) => {
@@ -121,7 +121,7 @@ impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx> {
121
121
}
122
122
123
123
#[ instrument( level = "trace" , skip( self ) ) ]
124
- fn visit_expr ( & mut self , ex : & Expr < ' tcx > ) {
124
+ fn visit_expr ( & mut self , ex : & ' p Expr < ' tcx > ) {
125
125
match ex. kind {
126
126
ExprKind :: Scope { value, lint_level, .. } => {
127
127
self . with_lint_level ( lint_level, |this| {
@@ -174,7 +174,7 @@ impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx> {
174
174
self . with_let_source ( LetSource :: None , |this| visit:: walk_expr ( this, ex) ) ;
175
175
}
176
176
177
- fn visit_stmt ( & mut self , stmt : & Stmt < ' tcx > ) {
177
+ fn visit_stmt ( & mut self , stmt : & ' p Stmt < ' tcx > ) {
178
178
match stmt. kind {
179
179
StmtKind :: Let {
180
180
box ref pattern, initializer, else_block, lint_level, span, ..
@@ -195,7 +195,7 @@ impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx> {
195
195
}
196
196
}
197
197
198
- impl < ' thir , ' p , ' tcx > MatchVisitor < ' thir , ' p , ' tcx > {
198
+ impl < ' p , ' tcx > MatchVisitor < ' p , ' tcx > {
199
199
#[ instrument( level = "trace" , skip( self , f) ) ]
200
200
fn with_let_source ( & mut self , let_source : LetSource , f : impl FnOnce ( & mut Self ) ) {
201
201
let old_let_source = self . let_source ;
@@ -224,7 +224,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
224
224
/// subexpressions we are not handling ourselves.
225
225
fn visit_land (
226
226
& mut self ,
227
- ex : & Expr < ' tcx > ,
227
+ ex : & ' p Expr < ' tcx > ,
228
228
accumulator : & mut Vec < Option < ( Span , RefutableFlag ) > > ,
229
229
) -> Result < ( ) , ErrorGuaranteed > {
230
230
match ex. kind {
@@ -251,7 +251,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
251
251
/// expression. This must call `visit_expr` on the subexpressions we are not handling ourselves.
252
252
fn visit_land_rhs (
253
253
& mut self ,
254
- ex : & Expr < ' tcx > ,
254
+ ex : & ' p Expr < ' tcx > ,
255
255
) -> Result < Option < ( Span , RefutableFlag ) > , ErrorGuaranteed > {
256
256
match ex. kind {
257
257
ExprKind :: Scope { value, lint_level, .. } => {
@@ -276,7 +276,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
276
276
fn lower_pattern (
277
277
& mut self ,
278
278
cx : & MatchCheckCtxt < ' p , ' tcx > ,
279
- pat : & Pat < ' tcx > ,
279
+ pat : & ' p Pat < ' tcx > ,
280
280
) -> Result < & ' p DeconstructedPat < ' p , ' tcx > , ErrorGuaranteed > {
281
281
if let Err ( err) = pat. pat_error_reported ( ) {
282
282
self . error = Err ( err) ;
@@ -395,7 +395,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
395
395
}
396
396
397
397
#[ instrument( level = "trace" , skip( self ) ) ]
398
- fn check_let ( & mut self , pat : & Pat < ' tcx > , scrutinee : Option < ExprId > , span : Span ) {
398
+ fn check_let ( & mut self , pat : & ' p Pat < ' tcx > , scrutinee : Option < ExprId > , span : Span ) {
399
399
assert ! ( self . let_source != LetSource :: None ) ;
400
400
let scrut = scrutinee. map ( |id| & self . thir [ id] ) ;
401
401
if let LetSource :: PlainLet = self . let_source {
@@ -547,7 +547,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
547
547
548
548
fn analyze_binding (
549
549
& mut self ,
550
- pat : & Pat < ' tcx > ,
550
+ pat : & ' p Pat < ' tcx > ,
551
551
refutability : RefutableFlag ,
552
552
scrut : Option < & Expr < ' tcx > > ,
553
553
) -> Result < ( MatchCheckCtxt < ' p , ' tcx > , UsefulnessReport < ' p , ' tcx > ) , ErrorGuaranteed > {
@@ -560,7 +560,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
560
560
561
561
fn is_let_irrefutable (
562
562
& mut self ,
563
- pat : & Pat < ' tcx > ,
563
+ pat : & ' p Pat < ' tcx > ,
564
564
scrut : Option < & Expr < ' tcx > > ,
565
565
) -> Result < RefutableFlag , ErrorGuaranteed > {
566
566
let ( cx, report) = self . analyze_binding ( pat, Refutable , scrut) ?;
@@ -575,7 +575,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
575
575
#[ instrument( level = "trace" , skip( self ) ) ]
576
576
fn check_binding_is_irrefutable (
577
577
& mut self ,
578
- pat : & Pat < ' tcx > ,
578
+ pat : & ' p Pat < ' tcx > ,
579
579
origin : & str ,
580
580
scrut : Option < & Expr < ' tcx > > ,
581
581
sp : Option < Span > ,
@@ -677,7 +677,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
677
677
/// - `x @ Some(ref mut? y)`.
678
678
///
679
679
/// This analysis is *not* subsumed by NLL.
680
- fn check_borrow_conflicts_in_at_patterns < ' tcx > ( cx : & MatchVisitor < ' _ , ' _ , ' tcx > , pat : & Pat < ' tcx > ) {
680
+ fn check_borrow_conflicts_in_at_patterns < ' tcx > ( cx : & MatchVisitor < ' _ , ' tcx > , pat : & Pat < ' tcx > ) {
681
681
// Extract `sub` in `binding @ sub`.
682
682
let PatKind :: Binding { name, mode, ty, subpattern : Some ( box ref sub) , .. } = pat. kind else {
683
683
return ;
@@ -772,7 +772,7 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>,
772
772
}
773
773
774
774
fn check_for_bindings_named_same_as_variants (
775
- cx : & MatchVisitor < ' _ , ' _ , ' _ > ,
775
+ cx : & MatchVisitor < ' _ , ' _ > ,
776
776
pat : & Pat < ' _ > ,
777
777
rf : RefutableFlag ,
778
778
) {
0 commit comments