@@ -27,6 +27,8 @@ pub(super) struct AnonymousArgInfo<'tcx> {
2727 pub arg_ty : Ty < ' tcx > ,
2828 // the ty::BoundRegion corresponding to the anonymous region
2929 pub bound_region : ty:: BoundRegion ,
30+ // arg_ty_span contains span of argument type
31+ pub arg_ty_span : Span ,
3032 // corresponds to id the argument is the first parameter
3133 // in the declaration
3234 pub is_first : bool ,
@@ -74,12 +76,16 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
7476 if let Some ( node_id) = hir. as_local_node_id ( id) {
7577 if let Some ( body_id) = hir. maybe_body_owned_by ( node_id) {
7678 let body = hir. body ( body_id) ;
79+ let owner_id = hir. body_owner ( body_id) ;
80+ let fn_decl = hir. fn_decl ( owner_id) . unwrap ( ) ;
7781 if let Some ( tables) = self . tables {
7882 body. arguments
7983 . iter ( )
8084 . enumerate ( )
8185 . filter_map ( |( index, arg) | {
8286 // May return None; sometimes the tables are not yet populated.
87+ let ty_hir_id = fn_decl. inputs [ index] . hir_id ;
88+ let arg_ty_span = hir. span ( hir. hir_to_node_id ( ty_hir_id) ) ;
8389 let ty = tables. node_id_to_type_opt ( arg. hir_id ) ?;
8490 let mut found_anon_region = false ;
8591 let new_arg_ty = self . tcx . fold_regions ( & ty, & mut false , |r, _| {
@@ -95,6 +101,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
95101 Some ( AnonymousArgInfo {
96102 arg : arg,
97103 arg_ty : new_arg_ty,
104+ arg_ty_span : arg_ty_span,
98105 bound_region : bound_region,
99106 is_first : is_first,
100107 } )
0 commit comments