-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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] Add support for associated items in "jump to def" feature #135771
base: master
Are you sure you want to change the base?
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…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`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Second commit is the interesting part: it overloads |
@@ -231,6 +231,24 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> { | |||
self.handle_pat(p); | |||
} | |||
|
|||
fn visit_qpath(&mut self, qpath: &QPath<'tcx>, id: HirId, span: Span) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no because of this case:
match self {
// Doesn't work.
Self::Ok(_) => {}
// Works.
MyEnum::Err(_) => {}
// Doesn't work
Self::Some(_) => {}
// Works.
Self::None => {}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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
bcd4e2e
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…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`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
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%) |
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
fd37239
Compare
☔ The latest upstream changes (presumably #134248) made this pull request unmergeable. Please resolve the merge conflicts. |
6b8b890
to
8f6eac5
Compare
Removed the first commit. Seems like PR is ready for review now. :) |
☔ The latest upstream changes (presumably #138127) made this pull request unmergeable. Please resolve the merge conflicts. |
8f6eac5
to
62eb9a7
Compare
Fixed merge conflicts. |
☔ The latest upstream changes (presumably #139257) made this pull request unmergeable. Please resolve the merge conflicts. |
62eb9a7
to
92e50fd
Compare
Fixed merge conflict. |
Fixes #135485.
r? @fmease