@@ -774,11 +774,11 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
774774
775775fn  has_late_bound_regions < ' a ,  ' tcx > ( tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
776776                                    node :  hir_map:: Node < ' tcx > ) 
777-                                     -> bool  { 
777+                                     -> Option < Span >  { 
778778    struct  LateBoundRegionsDetector < ' a ,  ' tcx :  ' a >  { 
779779        tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
780780        binder_depth :  u32 , 
781-         has_late_bound_regions :  bool , 
781+         has_late_bound_regions :  Option < Span > , 
782782    } 
783783
784784    impl < ' a ,  ' tcx >  Visitor < ' tcx >  for  LateBoundRegionsDetector < ' a ,  ' tcx >  { 
@@ -787,7 +787,7 @@ fn has_late_bound_regions<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
787787        } 
788788
789789        fn  visit_ty ( & mut  self ,  ty :  & ' tcx  hir:: Ty )  { 
790-             if  self . has_late_bound_regions  {  return  } 
790+             if  self . has_late_bound_regions . is_some ( )  {  return  } 
791791            match  ty. node  { 
792792                hir:: TyBareFn ( ..)  => { 
793793                    self . binder_depth  += 1 ; 
@@ -801,35 +801,35 @@ fn has_late_bound_regions<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
801801        fn  visit_poly_trait_ref ( & mut  self , 
802802                                tr :  & ' tcx  hir:: PolyTraitRef , 
803803                                m :  hir:: TraitBoundModifier )  { 
804-             if  self . has_late_bound_regions  {  return  } 
804+             if  self . has_late_bound_regions . is_some ( )  {  return  } 
805805            self . binder_depth  += 1 ; 
806806            intravisit:: walk_poly_trait_ref ( self ,  tr,  m) ; 
807807            self . binder_depth  -= 1 ; 
808808        } 
809809
810810        fn  visit_lifetime ( & mut  self ,  lt :  & ' tcx  hir:: Lifetime )  { 
811-             if  self . has_late_bound_regions  {  return  } 
811+             if  self . has_late_bound_regions . is_some ( )  {  return  } 
812812
813813            match  self . tcx . named_region_map . defs . get ( & lt. id ) . cloned ( )  { 
814814                Some ( rl:: Region :: Static )  | Some ( rl:: Region :: EarlyBound ( ..) )  => { } 
815815                Some ( rl:: Region :: LateBound ( debruijn,  _) )  |
816816                Some ( rl:: Region :: LateBoundAnon ( debruijn,  _) ) 
817817                    if  debruijn. depth  < self . binder_depth  => { } 
818-                 _ => self . has_late_bound_regions  = true , 
818+                 _ => self . has_late_bound_regions  = Some ( lt . span ) , 
819819            } 
820820        } 
821821    } 
822822
823823    fn  has_late_bound_regions < ' a ,  ' tcx > ( tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
824824                                        generics :  & ' tcx  hir:: Generics , 
825825                                        decl :  & ' tcx  hir:: FnDecl ) 
826-                                         -> bool  { 
826+                                         -> Option < Span >  { 
827827        let  mut  visitor = LateBoundRegionsDetector  { 
828-             tcx,  binder_depth :  1 ,  has_late_bound_regions :  false 
828+             tcx,  binder_depth :  1 ,  has_late_bound_regions :  None 
829829        } ; 
830830        for  lifetime in  & generics. lifetimes  { 
831831            if  tcx. named_region_map . late_bound . contains ( & lifetime. lifetime . id )  { 
832-                 return  true ; 
832+                 return  Some ( lifetime . lifetime . span ) ; 
833833            } 
834834        } 
835835        visitor. visit_fn_decl ( decl) ; 
@@ -840,24 +840,24 @@ fn has_late_bound_regions<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
840840        hir_map:: NodeTraitItem ( item)  => match  item. node  { 
841841            hir:: TraitItemKind :: Method ( ref  sig,  _)  =>
842842                has_late_bound_regions ( tcx,  & sig. generics ,  & sig. decl ) , 
843-             _ => false , 
843+             _ => None , 
844844        } , 
845845        hir_map:: NodeImplItem ( item)  => match  item. node  { 
846846            hir:: ImplItemKind :: Method ( ref  sig,  _)  =>
847847                has_late_bound_regions ( tcx,  & sig. generics ,  & sig. decl ) , 
848-             _ => false , 
848+             _ => None , 
849849        } , 
850850        hir_map:: NodeForeignItem ( item)  => match  item. node  { 
851851            hir:: ForeignItemFn ( ref  fn_decl,  _,  ref  generics)  =>
852852                has_late_bound_regions ( tcx,  generics,  fn_decl) , 
853-             _ => false , 
853+             _ => None , 
854854        } , 
855855        hir_map:: NodeItem ( item)  => match  item. node  { 
856856            hir:: ItemFn ( ref  fn_decl,  ..,  ref  generics,  _)  =>
857857                has_late_bound_regions ( tcx,  generics,  fn_decl) , 
858-             _ => false , 
858+             _ => None , 
859859        } , 
860-         _ => false 
860+         _ => None 
861861    } 
862862} 
863863
0 commit comments