-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
rustdoc: Fix intra-doc link bugs involving type aliases and associated items #150586
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
base: main
Are you sure you want to change the base?
Conversation
|
Is it ready for review? (It's a draft so wondering ^^') |
|
I'm planning to add one more commit, but it's mostly done. |
|
It's best reviewed commit-by-commit btw since I moved a lot of code around. |
|
☔ The latest upstream changes (presumably #150645) made this pull request unmergeable. Please resolve the merge conflicts. |
1 similar comment
|
☔ The latest upstream changes (presumably #150645) made this pull request unmergeable. Please resolve the merge conflicts. |
Previously, these failed to resolve, despite them working for struct fields or enum variants that were behind aliases. However, there is now an inconsistency where enum variant fields behind an alias resolve to the entry on the alias's page, while enum variants and struct fields resolve to the page of the backing ADT.
The old name and API were confusing. In my opinion, looking up the type at the call site is clearer.
All the other parts of this function return the Res for the containing page, but for some reason, this returns the associated item itself. It doesn't seem to affect the behavior of rustdoc because e.g. the href functions use the parent if the DefId is for an assoc item. But it's clearer and simpler to be consistent.
2bd0b56 to
844ae64
Compare
|
Ok, I think this is ready for review now. It doesn't fix all the inconsistencies with type aliases and associated items, but it does improve the status quo and adds some tests so we'll notice if/when we change things. The rules around when impls from an aliased type are inlined into the alias's docs seem pretty arbitrary and inconsistent, so we should probably nail that down before we adjust where intra-doc links go. |
This comment has been minimized.
This comment has been minimized.
844ae64 to
2b618ed
Compare
This PR:
Future steps:
r? @GuillaumeGomez