File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -838,9 +838,23 @@ fn print_higher_ranked_params_with_space(
838838pub ( crate ) fn print_anchor ( did : DefId , text : Symbol , cx : & Context < ' _ > ) -> impl Display {
839839 fmt:: from_fn ( move |f| {
840840 if let Ok ( HrefInfo { url, kind, rust_path } ) = href ( did, cx) {
841+ let tcx = cx. tcx ( ) ;
842+ let def_kind = tcx. def_kind ( did) ;
843+ let anchor = if matches ! (
844+ def_kind,
845+ DefKind :: AssocTy | DefKind :: AssocFn | DefKind :: AssocConst | DefKind :: Variant
846+ ) {
847+ let parent_def_id = tcx. parent ( did) ;
848+ let item_type =
849+ ItemType :: from_def_kind ( def_kind, Some ( tcx. def_kind ( parent_def_id) ) ) ;
850+ format ! ( "#{}.{}" , item_type. as_str( ) , tcx. item_name( did) )
851+ } else {
852+ String :: new ( )
853+ } ;
854+
841855 write ! (
842856 f,
843- r#"<a class="{kind}" href="{url}" title="{kind} {path}">{text}</a>"# ,
857+ r#"<a class="{kind}" href="{url}{anchor} " title="{kind} {path}">{text}</a>"# ,
844858 path = join_path_syms( rust_path) ,
845859 text = EscapeBodyText ( text. as_str( ) ) ,
846860 )
You can’t perform that action at this time.
0 commit comments