-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 picks an odd "canonical" path for some often-reexported types #124608
Comments
I think this needs solved using rust-lang/rfcs#3011. The behavior you’re seeing here is the same as the behavior in the standard library (except we actually want it in that context), combined with Search preferring shorter paths. If you want a workaround for right now, mark the re-export as |
Ah, that's what that attribute does. :D |
The standard library feels special, in that we often want to use the In the end, the best path to use depends on where in rustc one is working. Maybe the page for |
Edit: Please check out #124608 (comment) first. While the user-facing behavior described below can be reproduced as described, my attempt at an explanation is incorrect.
Just to give more context to future readers: The exact outcome depends on the “current location”, i.e. which crate you are currently viewing. If you follow the link https://doc.rust-lang.org/nightly/nightly-rustc, the current crate will be However, if you navigate to the index page of crate |
…r=fmease interpret: hide some reexports in rustdoc Cc rust-lang#124608
Ah, interesting, I had no idea the result would differ depending on the crate. But I supposed if I use the rustc_middle crate page then items defined "later" just cannot be found at all, right? |
Actually those items can be found contrary to the re-exports (just tested it). I don't know why there exists this discrepancy as I'm not super familiar with rustdoc search, @notriddle is the expert here. |
…r=fmease interpret: hide some reexports in rustdoc Cc rust-lang#124608
Rustdoc Search generates a single search index file that contains items for all crates that have been documented together, and every page in a set of docs loads the same index. When more docs are added to an existing set, the rustdoc compiler merges the new items into the existing index file. The current crate is given higher ranking in the search results, but that's a mere ranking signal, not a necessary side-effect of the way it's built. If it's a usability problem, it can be removed. It's more complicated for the plain HTML pages, which aren't as easy to merge as JSON files (especially since the search index was designed to be easy to merge this way). |
Rollup merge of rust-lang#124627 - RalfJung:interpret-doc-no-inline, r=fmease interpret: hide some reexports in rustdoc Cc rust-lang#124608
Ah, I see. Thanks for the explanation. Sorry for spreading misinformation before. |
interpret: hide some reexports in rustdoc Cc rust-lang/rust#124608
It seems that recently, rustdoc started to not show duplicate results for a type when it gets reexported. That is great! However, the name it decides to pick is sometimes odd.
Consider for instance
InterpError
: rustdoc shows this asmiri::InterpError
, which makes it look like a type defined in Miri. That's not the case though, the type is defined in rustc_middle. I would have expected this to be shown asrustc_middle::mir::interpret::InterpError
-- that's the canonical path for this type, as far as I am concerned. Certainly it should be showing some rustc crate as otherwise one could easily think that this type is not available outside Miri.Cc @rust-lang/rustdoc
The text was updated successfully, but these errors were encountered: