@@ -342,7 +342,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
342
342
argument_index,
343
343
) ;
344
344
345
- self . highlight_if_we_can_match_hir_ty_from_argument ( fr, arg_ty, argument_index)
345
+ self . get_argument_hir_ty_for_highlighting ( argument_index)
346
+ . and_then ( |arg_hir_ty| self . highlight_if_we_can_match_hir_ty ( fr, arg_ty, arg_hir_ty) )
346
347
. or_else ( || {
347
348
// `highlight_if_we_cannot_match_hir_ty` needs to know the number we will give to
348
349
// the anonymous region. If it succeeds, the `synthesize_region_name` call below
@@ -356,12 +357,10 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
356
357
} )
357
358
}
358
359
359
- fn highlight_if_we_can_match_hir_ty_from_argument (
360
+ fn get_argument_hir_ty_for_highlighting (
360
361
& self ,
361
- needle_fr : RegionVid ,
362
- argument_ty : Ty < ' tcx > ,
363
362
argument_index : usize ,
364
- ) -> Option < RegionNameHighlight > {
363
+ ) -> Option < & hir :: Ty < ' tcx > > {
365
364
let mir_hir_id = self . infcx . tcx . hir ( ) . as_local_hir_id ( self . mir_def_id ) ;
366
365
let fn_decl = self . infcx . tcx . hir ( ) . fn_decl_by_hir_id ( mir_hir_id) ?;
367
366
let argument_hir_ty: & hir:: Ty < ' _ > = fn_decl. inputs . get ( argument_index) ?;
@@ -373,7 +372,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
373
372
// (`give_name_if_anonymous_region_appears_in_arguments`).
374
373
hir:: TyKind :: Infer => None ,
375
374
376
- _ => self . highlight_if_we_can_match_hir_ty ( needle_fr , argument_ty , argument_hir_ty) ,
375
+ _ => Some ( argument_hir_ty) ,
377
376
}
378
377
}
379
378
0 commit comments