@@ -218,12 +218,18 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
218
218
cx. pattern_arena . alloc ( DeconstructedPat :: from_pat ( cx, & pattern) )
219
219
}
220
220
221
- fn new_cx ( & self , hir_id : HirId , refutable : bool ) -> MatchCheckCtxt < ' p , ' tcx > {
221
+ fn new_cx (
222
+ & self ,
223
+ hir_id : HirId ,
224
+ refutable : bool ,
225
+ match_span : Option < Span > ,
226
+ ) -> MatchCheckCtxt < ' p , ' tcx > {
222
227
MatchCheckCtxt {
223
228
tcx : self . tcx ,
224
229
param_env : self . param_env ,
225
230
module : self . tcx . parent_module ( hir_id) . to_def_id ( ) ,
226
231
pattern_arena : & self . pattern_arena ,
232
+ match_span,
227
233
refutable,
228
234
}
229
235
}
@@ -238,7 +244,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
238
244
return ;
239
245
}
240
246
self . check_patterns ( pat, Refutable ) ;
241
- let mut cx = self . new_cx ( self . lint_level , true ) ;
247
+ let mut cx = self . new_cx ( self . lint_level , true , None ) ;
242
248
let tpat = self . lower_pattern ( & mut cx, pat) ;
243
249
self . check_let_reachability ( & mut cx, self . lint_level , source, tpat, span) ;
244
250
}
@@ -250,7 +256,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
250
256
source : hir:: MatchSource ,
251
257
expr_span : Span ,
252
258
) {
253
- let mut cx = self . new_cx ( self . lint_level , true ) ;
259
+ let mut cx = self . new_cx ( self . lint_level , true , Some ( expr_span ) ) ;
254
260
255
261
for & arm in arms {
256
262
// Check the arm for some things unrelated to exhaustiveness.
@@ -363,7 +369,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
363
369
error = Err ( err) ;
364
370
return None ;
365
371
}
366
- let mut ncx = self . new_cx ( local_lint_level, true ) ;
372
+ let mut ncx = self . new_cx ( local_lint_level, true , None ) ;
367
373
let tpat = self . lower_pattern ( & mut ncx, pat) ;
368
374
let refutable = !is_let_irrefutable ( & mut ncx, local_lint_level, tpat) ;
369
375
Some ( ( expr. span , refutable) )
@@ -468,7 +474,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
468
474
return ;
469
475
}
470
476
471
- let mut cx = self . new_cx ( self . lint_level , false ) ;
477
+ let mut cx = self . new_cx ( self . lint_level , false , None ) ;
472
478
473
479
let pattern = self . lower_pattern ( & mut cx, pat) ;
474
480
let pattern_ty = pattern. ty ( ) ;
0 commit comments