@@ -86,7 +86,7 @@ struct MatchVisitor<'thir, 'p, 'tcx> {
86
86
thir : & ' thir Thir < ' tcx > ,
87
87
lint_level : HirId ,
88
88
let_source : LetSource ,
89
- pattern_arena : & ' p TypedArena < DeconstructedPat < ' p , ' tcx > > ,
89
+ pattern_arena : & ' p TypedArena < DeconstructedPat < ' p , ' thir , ' tcx > > ,
90
90
dropless_arena : & ' p DroplessArena ,
91
91
/// Tracks if we encountered an error while checking this body. That the first function to
92
92
/// report it stores it here. Some functions return `Result` to allow callers to short-circuit
@@ -279,9 +279,9 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
279
279
280
280
fn lower_pattern (
281
281
& mut self ,
282
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
282
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
283
283
pat : & ' thir Pat < ' tcx > ,
284
- ) -> Result < & ' p DeconstructedPat < ' p , ' tcx > , ErrorGuaranteed > {
284
+ ) -> Result < & ' p DeconstructedPat < ' p , ' thir , ' tcx > , ErrorGuaranteed > {
285
285
if let Err ( err) = pat. pat_error_reported ( ) {
286
286
self . error = Err ( err) ;
287
287
Err ( err)
@@ -374,7 +374,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
374
374
whole_match_span : Option < Span > ,
375
375
scrutinee : Option < & Expr < ' tcx > > ,
376
376
scrut_span : Span ,
377
- ) -> MatchCheckCtxt < ' p , ' tcx > {
377
+ ) -> MatchCheckCtxt < ' p , ' thir , ' tcx > {
378
378
let refutable = match refutability {
379
379
Irrefutable => false ,
380
380
Refutable => true ,
@@ -554,7 +554,8 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
554
554
pat : & ' thir Pat < ' tcx > ,
555
555
refutability : RefutableFlag ,
556
556
scrut : Option < & Expr < ' tcx > > ,
557
- ) -> Result < ( MatchCheckCtxt < ' p , ' tcx > , UsefulnessReport < ' p , ' tcx > ) , ErrorGuaranteed > {
557
+ ) -> Result < ( MatchCheckCtxt < ' p , ' thir , ' tcx > , UsefulnessReport < ' p , ' thir , ' tcx > ) , ErrorGuaranteed >
558
+ {
558
559
let cx = self . new_cx ( refutability, None , scrut, pat. span ) ;
559
560
let pat = self . lower_pattern ( & cx, pat) ?;
560
561
let arms = [ MatchArm { pat, arm_data : self . lint_level , has_guard : false } ] ;
@@ -840,9 +841,9 @@ fn report_irrefutable_let_patterns(
840
841
}
841
842
842
843
/// Report unreachable arms, if any.
843
- fn report_arm_reachability < ' p , ' tcx > (
844
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
845
- report : & UsefulnessReport < ' p , ' tcx > ,
844
+ fn report_arm_reachability < ' p , ' thir , ' tcx > (
845
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
846
+ report : & UsefulnessReport < ' p , ' thir , ' tcx > ,
846
847
) {
847
848
let report_unreachable_pattern = |span, hir_id, catchall : Option < Span > | {
848
849
cx. tcx . emit_spanned_lint (
@@ -880,7 +881,7 @@ fn report_arm_reachability<'p, 'tcx>(
880
881
}
881
882
882
883
/// Checks for common cases of "catchall" patterns that may not be intended as such.
883
- fn pat_is_catchall ( pat : & DeconstructedPat < ' _ , ' _ > ) -> bool {
884
+ fn pat_is_catchall ( pat : & DeconstructedPat < ' _ , ' _ , ' _ > ) -> bool {
884
885
match pat. ctor ( ) {
885
886
Constructor :: Wildcard => true ,
886
887
Constructor :: Struct | Constructor :: Ref => pat. iter_fields ( ) . all ( |pat| pat_is_catchall ( pat) ) ,
@@ -889,12 +890,12 @@ fn pat_is_catchall(pat: &DeconstructedPat<'_, '_>) -> bool {
889
890
}
890
891
891
892
/// Report that a match is not exhaustive.
892
- fn report_non_exhaustive_match < ' p , ' tcx > (
893
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
893
+ fn report_non_exhaustive_match < ' p , ' thir , ' tcx > (
894
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
894
895
thir : & Thir < ' tcx > ,
895
896
scrut_ty : Ty < ' tcx > ,
896
897
sp : Span ,
897
- witnesses : Vec < WitnessPat < ' p , ' tcx > > ,
898
+ witnesses : Vec < WitnessPat < ' p , ' thir , ' tcx > > ,
898
899
arms : & [ ArmId ] ,
899
900
expr_span : Span ,
900
901
) -> ErrorGuaranteed {
@@ -1089,12 +1090,12 @@ fn report_non_exhaustive_match<'p, 'tcx>(
1089
1090
err. emit ( )
1090
1091
}
1091
1092
1092
- fn joined_uncovered_patterns < ' p , ' tcx > (
1093
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
1094
- witnesses : & [ WitnessPat < ' p , ' tcx > ] ,
1093
+ fn joined_uncovered_patterns < ' p , ' thir , ' tcx > (
1094
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
1095
+ witnesses : & [ WitnessPat < ' p , ' thir , ' tcx > ] ,
1095
1096
) -> String {
1096
1097
const LIMIT : usize = 3 ;
1097
- let pat_to_str = |pat : & WitnessPat < ' p , ' tcx > | cx. hoist_witness_pat ( pat) . to_string ( ) ;
1098
+ let pat_to_str = |pat : & WitnessPat < ' p , ' thir , ' tcx > | cx. hoist_witness_pat ( pat) . to_string ( ) ;
1098
1099
match witnesses {
1099
1100
[ ] => bug ! ( ) ,
1100
1101
[ witness] => format ! ( "`{}`" , cx. hoist_witness_pat( witness) ) ,
@@ -1111,8 +1112,8 @@ fn joined_uncovered_patterns<'p, 'tcx>(
1111
1112
}
1112
1113
1113
1114
fn collect_non_exhaustive_tys < ' tcx > (
1114
- cx : & MatchCheckCtxt < ' _ , ' tcx > ,
1115
- pat : & WitnessPat < ' _ , ' tcx > ,
1115
+ cx : & MatchCheckCtxt < ' _ , ' _ , ' tcx > ,
1116
+ pat : & WitnessPat < ' _ , ' _ , ' tcx > ,
1116
1117
non_exhaustive_tys : & mut FxIndexSet < Ty < ' tcx > > ,
1117
1118
) {
1118
1119
if matches ! ( pat. ctor( ) , Constructor :: NonExhaustive ) {
@@ -1131,7 +1132,7 @@ fn collect_non_exhaustive_tys<'tcx>(
1131
1132
fn report_adt_defined_here < ' tcx > (
1132
1133
tcx : TyCtxt < ' tcx > ,
1133
1134
ty : Ty < ' tcx > ,
1134
- witnesses : & [ WitnessPat < ' _ , ' tcx > ] ,
1135
+ witnesses : & [ WitnessPat < ' _ , ' _ , ' tcx > ] ,
1135
1136
point_at_non_local_ty : bool ,
1136
1137
) -> Option < AdtDefinedHere < ' tcx > > {
1137
1138
let ty = ty. peel_refs ( ) ;
@@ -1153,10 +1154,10 @@ fn report_adt_defined_here<'tcx>(
1153
1154
Some ( AdtDefinedHere { adt_def_span, ty, variants } )
1154
1155
}
1155
1156
1156
- fn maybe_point_at_variant < ' a , ' p : ' a , ' tcx : ' p > (
1157
+ fn maybe_point_at_variant < ' a , ' p : ' a , ' thir : ' p , ' tcx : ' thir > (
1157
1158
tcx : TyCtxt < ' tcx > ,
1158
1159
def : AdtDef < ' tcx > ,
1159
- patterns : impl Iterator < Item = & ' a WitnessPat < ' p , ' tcx > > ,
1160
+ patterns : impl Iterator < Item = & ' a WitnessPat < ' p , ' thir , ' tcx > > ,
1160
1161
) -> Vec < Span > {
1161
1162
let mut covered = vec ! [ ] ;
1162
1163
for pattern in patterns {
0 commit comments