@@ -82,7 +82,7 @@ struct MatchVisitor<'thir, 'p, 'tcx> {
82
82
thir : & ' thir Thir < ' tcx > ,
83
83
lint_level : HirId ,
84
84
let_source : LetSource ,
85
- pattern_arena : & ' p TypedArena < DeconstructedPat < ' p , ' tcx > > ,
85
+ pattern_arena : & ' p TypedArena < DeconstructedPat < ' p , ' thir , ' tcx > > ,
86
86
dropless_arena : & ' p DroplessArena ,
87
87
/// Tracks if we encountered an error while checking this body. That the first function to
88
88
/// report it stores it here. Some functions return `Result` to allow callers to short-circuit
@@ -275,9 +275,9 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
275
275
276
276
fn lower_pattern (
277
277
& mut self ,
278
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
278
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
279
279
pat : & ' thir Pat < ' tcx > ,
280
- ) -> Result < & ' p DeconstructedPat < ' p , ' tcx > , ErrorGuaranteed > {
280
+ ) -> Result < & ' p DeconstructedPat < ' p , ' thir , ' tcx > , ErrorGuaranteed > {
281
281
if let Err ( err) = pat. pat_error_reported ( ) {
282
282
self . error = Err ( err) ;
283
283
Err ( err)
@@ -370,7 +370,7 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
370
370
whole_match_span : Option < Span > ,
371
371
scrutinee : Option < & Expr < ' tcx > > ,
372
372
scrut_span : Span ,
373
- ) -> MatchCheckCtxt < ' p , ' tcx > {
373
+ ) -> MatchCheckCtxt < ' p , ' thir , ' tcx > {
374
374
let refutable = match refutability {
375
375
Irrefutable => false ,
376
376
Refutable => true ,
@@ -550,7 +550,8 @@ impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx> {
550
550
pat : & ' thir Pat < ' tcx > ,
551
551
refutability : RefutableFlag ,
552
552
scrut : Option < & Expr < ' tcx > > ,
553
- ) -> Result < ( MatchCheckCtxt < ' p , ' tcx > , UsefulnessReport < ' p , ' tcx > ) , ErrorGuaranteed > {
553
+ ) -> Result < ( MatchCheckCtxt < ' p , ' thir , ' tcx > , UsefulnessReport < ' p , ' thir , ' tcx > ) , ErrorGuaranteed >
554
+ {
554
555
let cx = self . new_cx ( refutability, None , scrut, pat. span ) ;
555
556
let pat = self . lower_pattern ( & cx, pat) ?;
556
557
let arms = [ MatchArm { pat, arm_data : self . lint_level , has_guard : false } ] ;
@@ -836,9 +837,9 @@ fn report_irrefutable_let_patterns(
836
837
}
837
838
838
839
/// Report unreachable arms, if any.
839
- fn report_arm_reachability < ' p , ' tcx > (
840
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
841
- report : & UsefulnessReport < ' p , ' tcx > ,
840
+ fn report_arm_reachability < ' p , ' thir , ' tcx > (
841
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
842
+ report : & UsefulnessReport < ' p , ' thir , ' tcx > ,
842
843
) {
843
844
let report_unreachable_pattern = |span, hir_id, catchall : Option < Span > | {
844
845
cx. tcx . emit_spanned_lint (
@@ -876,7 +877,7 @@ fn report_arm_reachability<'p, 'tcx>(
876
877
}
877
878
878
879
/// Checks for common cases of "catchall" patterns that may not be intended as such.
879
- fn pat_is_catchall ( pat : & DeconstructedPat < ' _ , ' _ > ) -> bool {
880
+ fn pat_is_catchall ( pat : & DeconstructedPat < ' _ , ' _ , ' _ > ) -> bool {
880
881
match pat. ctor ( ) {
881
882
Constructor :: Wildcard => true ,
882
883
Constructor :: Struct | Constructor :: Ref => pat. iter_fields ( ) . all ( |pat| pat_is_catchall ( pat) ) ,
@@ -885,12 +886,12 @@ fn pat_is_catchall(pat: &DeconstructedPat<'_, '_>) -> bool {
885
886
}
886
887
887
888
/// Report that a match is not exhaustive.
888
- fn report_non_exhaustive_match < ' p , ' tcx > (
889
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
889
+ fn report_non_exhaustive_match < ' p , ' thir , ' tcx > (
890
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
890
891
thir : & Thir < ' tcx > ,
891
892
scrut_ty : Ty < ' tcx > ,
892
893
sp : Span ,
893
- witnesses : Vec < WitnessPat < ' p , ' tcx > > ,
894
+ witnesses : Vec < WitnessPat < ' p , ' thir , ' tcx > > ,
894
895
arms : & [ ArmId ] ,
895
896
expr_span : Span ,
896
897
) -> ErrorGuaranteed {
@@ -1085,12 +1086,12 @@ fn report_non_exhaustive_match<'p, 'tcx>(
1085
1086
err. emit ( )
1086
1087
}
1087
1088
1088
- fn joined_uncovered_patterns < ' p , ' tcx > (
1089
- cx : & MatchCheckCtxt < ' p , ' tcx > ,
1090
- witnesses : & [ WitnessPat < ' p , ' tcx > ] ,
1089
+ fn joined_uncovered_patterns < ' p , ' thir , ' tcx > (
1090
+ cx : & MatchCheckCtxt < ' p , ' thir , ' tcx > ,
1091
+ witnesses : & [ WitnessPat < ' p , ' thir , ' tcx > ] ,
1091
1092
) -> String {
1092
1093
const LIMIT : usize = 3 ;
1093
- let pat_to_str = |pat : & WitnessPat < ' p , ' tcx > | cx. hoist_witness_pat ( pat) . to_string ( ) ;
1094
+ let pat_to_str = |pat : & WitnessPat < ' p , ' thir , ' tcx > | cx. hoist_witness_pat ( pat) . to_string ( ) ;
1094
1095
match witnesses {
1095
1096
[ ] => bug ! ( ) ,
1096
1097
[ witness] => format ! ( "`{}`" , cx. hoist_witness_pat( witness) ) ,
@@ -1107,8 +1108,8 @@ fn joined_uncovered_patterns<'p, 'tcx>(
1107
1108
}
1108
1109
1109
1110
fn collect_non_exhaustive_tys < ' tcx > (
1110
- cx : & MatchCheckCtxt < ' _ , ' tcx > ,
1111
- pat : & WitnessPat < ' _ , ' tcx > ,
1111
+ cx : & MatchCheckCtxt < ' _ , ' _ , ' tcx > ,
1112
+ pat : & WitnessPat < ' _ , ' _ , ' tcx > ,
1112
1113
non_exhaustive_tys : & mut FxIndexSet < Ty < ' tcx > > ,
1113
1114
) {
1114
1115
if matches ! ( pat. ctor( ) , Constructor :: NonExhaustive ) {
@@ -1127,7 +1128,7 @@ fn collect_non_exhaustive_tys<'tcx>(
1127
1128
fn report_adt_defined_here < ' tcx > (
1128
1129
tcx : TyCtxt < ' tcx > ,
1129
1130
ty : Ty < ' tcx > ,
1130
- witnesses : & [ WitnessPat < ' _ , ' tcx > ] ,
1131
+ witnesses : & [ WitnessPat < ' _ , ' _ , ' tcx > ] ,
1131
1132
point_at_non_local_ty : bool ,
1132
1133
) -> Option < AdtDefinedHere < ' tcx > > {
1133
1134
let ty = ty. peel_refs ( ) ;
@@ -1149,10 +1150,10 @@ fn report_adt_defined_here<'tcx>(
1149
1150
Some ( AdtDefinedHere { adt_def_span, ty, variants } )
1150
1151
}
1151
1152
1152
- fn maybe_point_at_variant < ' a , ' p : ' a , ' tcx : ' p > (
1153
+ fn maybe_point_at_variant < ' a , ' p : ' a , ' thir : ' p , ' tcx : ' thir > (
1153
1154
tcx : TyCtxt < ' tcx > ,
1154
1155
def : AdtDef < ' tcx > ,
1155
- patterns : impl Iterator < Item = & ' a WitnessPat < ' p , ' tcx > > ,
1156
+ patterns : impl Iterator < Item = & ' a WitnessPat < ' p , ' thir , ' tcx > > ,
1156
1157
) -> Vec < Span > {
1157
1158
let mut covered = vec ! [ ] ;
1158
1159
for pattern in patterns {
0 commit comments