@@ -688,11 +688,24 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
688
688
}
689
689
}
690
690
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
+ } )
693
698
}
694
699
695
700
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 > {
696
709
// Returns true if the path is function type sugar, e.g., `Fn(A) -> B`.
697
710
fn fn_type ( seg : & ast:: PathSegment ) -> bool {
698
711
if let Some ( ref generic_args) = seg. args {
@@ -703,11 +716,11 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
703
716
false
704
717
}
705
718
706
- if path_seg . id == DUMMY_NODE_ID {
719
+ if id == DUMMY_NODE_ID {
707
720
return None ;
708
721
}
709
722
710
- let def = self . get_path_def ( path_seg . id ) ;
723
+ let def = self . get_path_def ( id) ;
711
724
let span = path_seg. ident . span ;
712
725
filter ! ( self . span_utils, span) ;
713
726
let span = self . span_from_span ( span) ;
0 commit comments