@@ -79,7 +79,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
79
79
CoerceMany :: with_coercion_sites ( coerce_first, arms)
80
80
} ;
81
81
82
- let mut other_arms = vec ! [ ] ; // Used only for diagnostics.
82
+ let mut prior_non_diverging_arms = vec ! [ ] ; // Used only for diagnostics.
83
83
let mut prior_arm = None ;
84
84
for arm in arms {
85
85
if let Some ( e) = & arm. guard {
@@ -120,7 +120,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
120
120
scrut_span : scrut. span ,
121
121
scrut_hir_id : scrut. hir_id ,
122
122
source : match_src,
123
- prior_arms : other_arms . clone ( ) ,
123
+ prior_non_diverging_arms : prior_non_diverging_arms . clone ( ) ,
124
124
opt_suggest_box_span,
125
125
} ) ) ,
126
126
) ,
@@ -142,16 +142,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
142
142
false ,
143
143
) ;
144
144
145
- other_arms. push ( arm_span) ;
146
- if other_arms. len ( ) > 5 {
147
- other_arms. remove ( 0 ) ;
148
- }
149
-
150
145
if !arm_ty. is_never ( ) {
151
146
// When a match arm has type `!`, then it doesn't influence the expected type for
152
147
// the following arm. If all of the prior arms are `!`, then the influence comes
153
148
// from elsewhere and we shouldn't point to any previous arm.
154
149
prior_arm = Some ( ( arm_block_id, arm_ty, arm_span) ) ;
150
+
151
+ prior_non_diverging_arms. push ( arm_span) ;
152
+ if prior_non_diverging_arms. len ( ) > 5 {
153
+ prior_non_diverging_arms. remove ( 0 ) ;
154
+ }
155
155
}
156
156
}
157
157
0 commit comments