@@ -827,19 +827,28 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
827
827
) -> Option < Res > {
828
828
// resolve() can't be used for macro namespace
829
829
let result = match ns {
830
- Namespace :: MacroNS => self . resolve_macro ( path_str, module_id) . map_err ( ErrorKind :: from) ,
830
+ Namespace :: MacroNS => self
831
+ . resolve_macro ( path_str, module_id)
832
+ . map ( |res| ( res, None ) )
833
+ . map_err ( ErrorKind :: from) ,
831
834
Namespace :: TypeNS | Namespace :: ValueNS => {
832
- self . resolve ( path_str, ns, module_id, extra_fragment) . map ( | ( res , _ ) | res )
835
+ self . resolve ( path_str, ns, module_id, extra_fragment)
833
836
}
834
837
} ;
835
838
836
839
let res = match result {
837
- Ok ( res) => Some ( res) ,
840
+ Ok ( ( res, frag) ) => {
841
+ if let Some ( UrlFragment :: Def ( _, id) ) = frag {
842
+ Some ( Res :: Def ( self . cx . tcx . def_kind ( id) , id) )
843
+ } else {
844
+ Some ( res)
845
+ }
846
+ }
838
847
Err ( ErrorKind :: Resolve ( box kind) ) => kind. full_res ( ) ,
839
848
Err ( ErrorKind :: AnchorFailure ( AnchorFailure :: RustdocAnchorConflict ( res) ) ) => Some ( res) ,
840
849
Err ( ErrorKind :: AnchorFailure ( AnchorFailure :: MultipleAnchors ) ) => None ,
841
850
} ;
842
- self . kind_side_channel . take ( ) . map ( | ( kind , id ) | Res :: Def ( kind , id ) ) . or ( res)
851
+ res
843
852
}
844
853
}
845
854
0 commit comments