-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rustdoc links items in the standard library to the original crate, not the re-export #78467
Comments
This is not really supported by intra-doc links. How should it know which re-exports are canonical and which are not? The best it can do is the original place the item was defined. |
Perhaps we could add some kind of attribute to a re-export (something like |
Note that this is not specific to intra-doc links, if you have a function returning string, rustdoc will also link to alloc, not std. |
Is the data used to decide when to inline the docs available during intra-doc links ( |
This logic is done by rust/src/librustdoc/html/format.rs Line 483 in 6bea76f
In particular, if it's not in cache.paths , it always looks in the original crate: rust/src/librustdoc/html/format.rs Line 497 in 6bea76f
I don't know what causes something to be in paths or extern_locations. |
This is actually a duplicate of #22083. |
So no: #82014 (comment) |
In my docs, I use
[`String`]
or even[`std::string::String`]
, I expect the generated link is to the std page, but the generated link is to the alloc page.I know maybe
std
re-exports some structs inalloc
,core
, etc. but for a beginner who does not know well about rust, he may be confused when clicking the link to String and get an unfamiliar path. So what can I do if I want to link tostd
page?Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: