[rustdoc] URL fragments handling should be unified
Opened this issue · 0 comments
GuillaumeGomez commented
Currently, we handle URL fragments (the # part) in at least three different locations:
html::format::print_anchorclean::Item::links(generates href from intra doc links)html::render::assoc_href_attr
The two first can be merged in a straighforward way: href_with_root_path should be split to allow to pass the "parent" DefId (which would be the same as the item DefId if it's not an associated item) directly. That would make it easier to be used from clean::Item::links. It will likely require changes in collect_intra_doc_links because UrlFragment::Item holds a DefId supposed to be of the associated item, but sometimes both UrlFragment::Item and ItemLink::page_id are the same (like methods on a trait), meaning something needs to be fixed there.
Once these two have been merged, we can look at merging with the third one.