Intra-doc links should implicitly add Self::
prefix as needed
#98270
Labels
A-intra-doc-links
Area: Intra-doc links, the ability to link to items in docs by name
Uh oh!
There was an error while loading. Please reload this page.
It's extremely common to reference methods on the same type when writing docs. For example,
Vec::reserve_exact
mentionsVec::reserve
.In almost all of these cases, the method being linked doesn't include the full type or
Self::
in the actual text, and has to resort to copying the method name withSelf::
in the link destination.It would be nice if rustdoc automatically resolved these links without the need to add the extra
Self::
prefix. For example, writing[`reserve`]
should automatically resolve toSelf::reserve
if areserve
item doesn't exist on its own. If both the method and the standalone item exist, we could add a lint to point out the ambiguity, requiring the user to clarify eitherself::reserve
orSelf::reserve
; this feels like the best move to avoid changing the existing behaviour.Either way, this pattern feels very common and seems like a papercut that makes documentation just a little bit harder to write.
The text was updated successfully, but these errors were encountered: