-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: emit JS paths for struct-like variants #64724
Conversation
On the backend, rustdoc now emits `paths` entries to a crate's search index for struct-like enum variants, and index items of type structfield which belong to such variants point to their variant parents in the `paths` table, rather than their enum grandparents. The path entry for a variant is the fully qualified module path plus the enum name. On the frontend, the search code recognizes structfields belonging to structlike variants in the `paths` table and re-constructs the URL to the field's anchor on the enum documentation page. closes rust-lang#16017
For e.g. core or std, how much of a size increase is this? |
I'll measure to be sure, but was careful (at least, tried to be!) to make this "zero cost"* in size of *: Rustdoc prunes entries from the paths table that are unreferenced by search index items, i.e., any variants which don't have structfields shouldn't appear in the paths table. |
☔ The latest upstream changes (presumably #64751) made this pull request unmergeable. Please resolve the merge conflicts. |
I ran
So the search index has a size increase of 220 bytes or 0.015%. |
The extra bytes come from adding a path for this variant: https://doc.rust-lang.org/nightly/std/collections/enum.TryReserveError.html#variant.AllocError |
That size increase looks entirely reasonable :) Thanks for investigating! |
Ping from triage. |
Pinging again from triage. |
Ping from Triage: Closing due to inactivity. @tomjakubowski please reopen with any updates. Thanks for the PR. |
…-search, r=kinnison Struct variant field search Fixes rust-lang#16017. Reopening of rust-lang#64724. cc @tomjakubowski cc @ollie27 r? @kinnison
…-search, r=kinnison Struct variant field search Fixes rust-lang#16017. Reopening of rust-lang#64724. cc @tomjakubowski cc @ollie27 r? @kinnison
…ollie27 Struct variant field search Fixes #16017. Reopening of #64724. cc @tomjakubowski cc @ollie27 r? @kinnison
On the backend, rustdoc now emits
paths
entries to a crate's searchindex for struct-like enum variants, and index items of type structfield
which belong to such variants point to their variant parents in the
paths
table, rather than their enum grandparents. The path entry fora variant is the fully qualified module path plus the enum name.
On the frontend, the search code recognizes structfields belonging to
structlike variants in the
paths
table and re-constructs the URL tothe field's anchor on the enum documentation page.
closes #16017