Repository navigation
[rustdoc] Correctly link to (imported) enum variants with "jump to def" - #163682
Merged
Merged
Conversation
Urgau
reviewed
Oct 2, 2026
| return Err(HrefError::Private); | ||
| } else { | ||
| return generate_item_def_id_path(did, original_did, cx, root_path); | ||
| } |
Member
There was a problem hiding this comment.
Just to be sure I understood what's happening, with the test case we would end-up in this else branch, right?
| // performed there. | ||
| let def_id_to_get = if root_path.is_some() { original_did } else { did }; | ||
| if let Some(&(ref fqp, shortty)) = cache.external_paths.get(&def_id_to_get) { | ||
| if (root_path.is_none() || original_did == did) |
Member
There was a problem hiding this comment.
Would be good to add a little comment for why we are checking original_did == did, it's not obvious at first glace.
Member
Author
There was a problem hiding this comment.
Fair enough, adding it.
…s` when using the `--generate-link-to-definition` feature
GuillaumeGomez
force-pushed
the
jump-to-variant
branch
from
October 3, 2026 12:18
a794bd0 to
56bb244
Compare
Member
Author
|
Extended doc comments to make it more clear what was expected. |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Oct 3, 2026
…Urgau [rustdoc] Correctly link to (imported) enum variants with "jump to def" New bug I found while working on rust-lang#162808. Explanations: this one was quite tricky as it took me a while to understand that variants could be imported and present in `Cache::external_paths`. So the path was entered while generating a link for "jump to def", generating a URL looking like this: `module/enum_name/variant.variant_name.html`, which is obviously very wrong as it should be `module/enum.enum_name.html#variant.variant_name`. r? @Urgau
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Oct 3, 2026
…Urgau [rustdoc] Correctly link to (imported) enum variants with "jump to def" New bug I found while working on rust-lang#162808. Explanations: this one was quite tricky as it took me a while to understand that variants could be imported and present in `Cache::external_paths`. So the path was entered while generating a link for "jump to def", generating a URL looking like this: `module/enum_name/variant.variant_name.html`, which is obviously very wrong as it should be `module/enum.enum_name.html#variant.variant_name`. r? @Urgau
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 4, 2026
Rollup of 18 pull requests Successful merges: - #158102 (When compiling without a specified `--edition`, emit a message) - #162027 (std: add `fs::rename_noreplace`) - #162761 (Lower attributes for functions without bodies) - #163161 (implement FCW for `rustc_allowed_through_unstable_modules` items) - #163613 (Tweak the rendering of "not general enough" errors on the old trait solver) - #162062 (core: fix the docs of PanicInfo::location) - #163140 (document safety requirements for atomic intrinsics) - #163342 (Don't imply incorrect things about `Global` in the docs of `System`) - #163445 (Add safety comments for alloc::str) - #163503 (Mark Rc strong/weak count methods must_use) - #163548 (fs::set_permissions_nofollow: Android support, test cleanup) - #163585 ([triagebot] Create `debugger_visualizer` assign group) - #163597 (Add `SplitPathsRef` implementation for motor to make std build) - #163602 (Move media & home dirs tests to fs tests.) - #163667 (Finalize changes on expect messages for library/core/src/fmt/mod.rs) - #163682 ([rustdoc] Correctly link to (imported) enum variants with "jump to def") - #163683 (Fix GCC codegen backend comment in bootstrap) - #163703 (Move more `rustdoc-html tests` in the right location) Failed merges: - #161491 (Rip out old solver coherence)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 4, 2026
Rollup of 18 pull requests Successful merges: - #158102 (When compiling without a specified `--edition`, emit a message) - #162761 (Lower attributes for functions without bodies) - #163161 (implement FCW for `rustc_allowed_through_unstable_modules` items) - #163613 (Tweak the rendering of "not general enough" errors on the old trait solver) - #162062 (core: fix the docs of PanicInfo::location) - #163140 (document safety requirements for atomic intrinsics) - #163342 (Don't imply incorrect things about `Global` in the docs of `System`) - #163445 (Add safety comments for alloc::str) - #163503 (Mark Rc strong/weak count methods must_use) - #163548 (fs::set_permissions_nofollow: Android support, test cleanup) - #163585 ([triagebot] Create `debugger_visualizer` assign group) - #163597 (Add `SplitPathsRef` implementation for motor to make std build) - #163602 (Move media & home dirs tests to fs tests.) - #163667 (Finalize changes on expect messages for library/core/src/fmt/mod.rs) - #163682 ([rustdoc] Correctly link to (imported) enum variants with "jump to def") - #163683 (Fix GCC codegen backend comment in bootstrap) - #163703 (Move more `rustdoc-html tests` in the right location) - #163725 (some crashes fixed with next-solver) Failed merges: - #161491 (Rip out old solver coherence)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 4, 2026
Rollup merge of #163682 - GuillaumeGomez:jump-to-variant, r=Urgau [rustdoc] Correctly link to (imported) enum variants with "jump to def" New bug I found while working on #162808. Explanations: this one was quite tricky as it took me a while to understand that variants could be imported and present in `Cache::external_paths`. So the path was entered while generating a link for "jump to def", generating a URL looking like this: `module/enum_name/variant.variant_name.html`, which is obviously very wrong as it should be `module/enum.enum_name.html#variant.variant_name`. r? @Urgau
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New bug I found while working on #162808.
Explanations: this one was quite tricky as it took me a while to understand that variants could be imported and present in
Cache::external_paths. So the path was entered while generating a link for "jump to def", generating a URL looking like this:module/enum_name/variant.variant_name.html, which is obviously very wrong as it should bemodule/enum.enum_name.html#variant.variant_name.r? @Urgau