Uh oh!
There was an error while loading. Please reload this page.
[rustdoc] Add support for associated items in "jump to def" feature - #135771
Conversation
GuillaumeGomez
commented
Jan 20, 2025
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Jan 20, 2025
…try> [PERF for "jump to def"] Re-enable "jump to def" feature on rustc docs This PR is NOT meant to be merged. `@fmease` and I are using it to check perfs on the "jump to def" feature. r? `@fmease`
bors
commented
Jan 20, 2025
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
GuillaumeGomez
commented
Jan 20, 2025
Second commit is the interesting part: it overloads |
| self.handle_pat(p); | ||
| } | ||
| fn visit_qpath(&mut self, qpath: &QPath<'tcx>, id: HirId, span: Span) { |
There was a problem hiding this comment.
You should now be able to remove the visit_pat and handle_pat methods entirely thanks to this overwrite. Unless I'm forgetting things.
There was a problem hiding this comment.
Unfortunately no because of this case:
matchself{// Doesn't work.Self::Ok(_) => {}// Works.MyEnum::Err(_) => {}// Doesn't workSelf::Some(_) => {}// Works.Self::None => {}}There was a problem hiding this comment.
Right, I'm pretty sure that there's a way to do it (by using the maybe_typeck_results pattern I mentioned back then on Zulip). After all, the cleanup part is all about getting rid of {visit,handle}_pat for me personally.
I'm gonna be afk in a sec, so I can't explain the maybe_typeck_results approach rn and I don't know if you can decipher my past rambling on Zulip. Well, you can check out rustc since it uses the "maybe_typeck_results pattern" quite frequently.
There was a problem hiding this comment.
It's fine. Gonna give it a try and if I can't gonna let you do it since you seem to have a clear implementation in mind.
There was a problem hiding this comment.
I'll experiment later. Ofc, you can always try reading through hir::intravisit and see which methods don't get called in this PR which do get called on master, maybe there's a more obvious 'bug'.
There was a problem hiding this comment.
I uncovered the maybe_typeck_results dark arcanes and fixed it. I wonder if there is a shorter way though, code still seems longer than it needs to be...
There was a problem hiding this comment.
I'll check that soon. In any case, since this fixes things / adds support for more path types, I'd say it'd be fine even if we couldn't simplify it.
Also, with this method rustdoc should now be able to resolve fully-qualified paths (<$Type as $TraitRef>::$assoc), too, and that in all positions (expr, pat, type). On master, we don't support those at all iirc. However, I haven't double-checked if your impl is sufficient or if you still need to hook up some things. Could you add tests for them if this PR makes them work?
rust-timer
commented
Jan 20, 2025
Finished benchmarking commit (884d495): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 1.9%, secondary 2.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 2.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 767.44s -> 767.097s (-0.04%) |
7a5b759 to
bcd4e2eCompareGuillaumeGomez
commented
Jan 20, 2025
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Jan 20, 2025
…try> [PERF for "jump to def"] Re-enable "jump to def" feature on rustc docs This PR is NOT meant to be merged. `@fmease` and I are using it to check perfs on the "jump to def" feature. Used for rust-lang#135485. r? `@fmease`
bors
commented
Jan 20, 2025
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Jan 20, 2025
Finished benchmarking commit (4f36aac): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 1.8%, secondary 0.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -2.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 766.257s -> 767.122s (0.11%) |
GuillaumeGomez
commented
Jan 26, 2025
Made more changes which had some interesting side-effects: we now have items in a same path that can generate links. However, projections still link to where the item is defined in the trait and not in the trait implementation, which is a bit sad... You can check it here. |
This comment has been minimized.
This comment has been minimized.
791fdff to
fd37239Compare687ac3f to
25e767bCompareGuillaumeGomez
commented
Aug 10, 2025
For now we (correctly) ignore associated types. |
GuillaumeGomez
commented
Aug 21, 2025
@rustbot ready |
GuillaumeGomez
commented
Sep 25, 2025
Forgot to r+ it... @bors r=fmease rollup |
bors
commented
Sep 25, 2025
…=fmease [rustdoc] Add support for associated items in "jump to def" feature Fixesrust-lang#135485. r? `@fmease`
Rollup of 8 pull requests Successful merges: - #116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - #142401 (Add proper name mangling for pattern types) - #146293 (feat: non-panicking `Vec::try_remove`) - #146859 (BTreeMap: Don't leak allocators when initializing nodes) - #146924 (Add doc for `NonZero*` const creation) - #146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
Uh oh!
There was an error while loading. Please reload this page.
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang#142401 (Add proper name mangling for pattern types) - rust-lang#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang#146924 (Add doc for `NonZero*` const creation) - rust-lang#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
Fixes#135485.
r? @fmease