Uh oh!
There was an error while loading. Please reload this page.
rustdoc: Stop textually replacing Self in doc links before resolving them - #93805
Conversation
rust-highfive
commented
Feb 9, 2022
(rust-highfive has picked a reviewer for you, use r? to override) |
GuillaumeGomez
commented
Feb 9, 2022
Looks good to me, thanks! Better have @camelid take a look too. |
This comment has been minimized.
This comment has been minimized.
29017ca to
07f3429Comparepetrochenkov
commented
Feb 9, 2022
r? @camelid |
camelid
commented
Feb 9, 2022
Thanks for doing this! I've been wanting to fix this hack for a while. I'll review this soon. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…g them Resolve it directly to a type / def-id instead. Also never pass `Self` to `Resolver`, it is useless because it's guaranteed that no resolution will be found.
07f3429 to
25c5e39Comparepetrochenkov
commented
Feb 13, 2022
@rustbot ready |
camelid
left a comment
There was a problem hiding this comment.
Sorry this took so long. I only have one question; other than that, this looks great!
| #[derive(Clone, Debug, Hash, PartialEq, Eq)] | ||
| struct ResolutionInfo { | ||
| item_id: ItemId, | ||
| module_id: DefId, |
There was a problem hiding this comment.
Just wondering, could we remove module_id now that we have item_id? Not necessary to address now, but I wanted to bring it up.
There was a problem hiding this comment.
Not without replacing it with some extra data, I tried it but wasn't able to do it right away.
The first issue is that rustdoc (unlike rustc) resolves paths differently in inner and outer attributes.
So item_id will be the same for inner and outer paths, but their module_ids will be different.
There are also may be nuances with how item_id and module_id are assigned for reexports, but I didn't investigate it.
I agree that ideally we would have an item_id and some additional orthogonal flags here instead of the module_id.
Uh oh!
There was an error while loading. Please reload this page.
camelid
commented
Mar 6, 2022
@bors r=camelid,GuillaumeGomez |
bors
commented
Mar 6, 2022
📌 Commit 25c5e39 has been approved by |
camelid
commented
Mar 6, 2022
Wow, that regression is way higher than I expected. I thought this PR might improve perf. I still think this change is worth the regression, but do you know what caused the regression? Maybe the extra |
petrochenkov
commented
Mar 9, 2022
I'll try to benchmark this, but not earlier than landing the last part of #83761. |
pnkfelix
commented
Mar 9, 2022
It looks to me like collect_intra_doc_links got 8.8% slower on serde doc. It took 0.137 s before this PR, and 0.149 s after this PR. If I had to guess, I would assume the slowdown is due to the extra Its funny that the slowdown only registered on serde doc though. If you want to look further, @petrochenkov , then that would be great. But I don't think we need to spend too much time dissecting this, and I'm going to treat it as triaged. @rustbot label: +perf-regression-triaged |
camelid
commented
Mar 10, 2022
|
This issue was most likely fixed by rust-lang#93805.
Add regression test for rust-lang#93205Closesrust-lang#93205. This issue was most likely fixed by rust-lang#93805.
The report at rust-lang/rust#93205 was closed as it has presumably been fixed in rust-lang/rust#93805 which has long trickled down into stable releases, and I cannot reproduce the issue on `1.62.1` anymore (latest stable as of writing) 🎉 This workaround was originally added in #559.
The report at rust-lang/rust#93205 was closed as it has presumably been fixed in rust-lang/rust#93805 which has long trickled down into stable releases, and I cannot reproduce the issue on `1.62.1` anymore (latest stable as of writing) 🎉 This workaround was originally added in #559.
The report at rust-lang/rust#93205 was closed as it has presumably been fixed in rust-lang/rust#93805 which has long trickled down into stable releases, and I cannot reproduce the issue on `1.62.1` anymore (latest stable as of writing) 🎉 This workaround was originally added in #559.
The report at rust-lang/rust#93205 was closed as it has presumably been fixed in rust-lang/rust#93805 which has long trickled down into stable releases, and I cannot reproduce the issue on `1.62.1` anymore (latest stable as of writing) 🎉 This workaround was originally added in #559.
The report at rust-lang/rust#93205 was closed as it has presumably been fixed in rust-lang/rust#93805 which has long trickled down into stable releases, and I cannot reproduce the issue on `1.62.1` anymore (latest stable as of writing) 🎉 This workaround was originally added in #559.
…omez rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang#93805 anyway.
…omez rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang#93805 anyway.
…omez rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang#93805 anyway.
…omez rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang#93805 anyway.
…omez rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang#93805 anyway.
…omez rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang#93805 anyway.
…omez rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang#93805 anyway.
rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixesrust-lang/rust#108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since rust-lang/rust#93805 anyway.
Resolve it directly to a type / def-id instead.
Also never pass
SelftoResolver, it is useless because it's guaranteed that no resolution will be found.This is a pre-requisite for #83761.