@@ -688,11 +688,24 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
688688 }
689689 }
690690
691- pub fn get_path_data ( & self , _id : NodeId , path : & ast:: Path ) -> Option < Ref > {
692- path. segments . last ( ) . and_then ( |seg| self . get_path_segment_data ( seg) )
691+ pub fn get_path_data ( & self , id : NodeId , path : & ast:: Path ) -> Option < Ref > {
692+ path. segments
693+ . last ( )
694+ . and_then ( |seg| {
695+ self . get_path_segment_data ( seg)
696+ . or_else ( || self . get_path_segment_data_with_id ( seg, id) )
697+ } )
693698 }
694699
695700 pub fn get_path_segment_data ( & self , path_seg : & ast:: PathSegment ) -> Option < Ref > {
701+ self . get_path_segment_data_with_id ( path_seg, path_seg. id )
702+ }
703+
704+ fn get_path_segment_data_with_id (
705+ & self ,
706+ path_seg : & ast:: PathSegment ,
707+ id : NodeId ,
708+ ) -> Option < Ref > {
696709 // Returns true if the path is function type sugar, e.g., `Fn(A) -> B`.
697710 fn fn_type ( seg : & ast:: PathSegment ) -> bool {
698711 if let Some ( ref generic_args) = seg. args {
@@ -703,11 +716,11 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
703716 false
704717 }
705718
706- if path_seg . id == DUMMY_NODE_ID {
719+ if id == DUMMY_NODE_ID {
707720 return None ;
708721 }
709722
710- let def = self . get_path_def ( path_seg . id ) ;
723+ let def = self . get_path_def ( id) ;
711724 let span = path_seg. ident . span ;
712725 filter ! ( self . span_utils, span) ;
713726 let span = self . span_from_span ( span) ;
0 commit comments