Uh oh!
There was an error while loading. Please reload this page.
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. closesrust-lang#16017
tomjakubowski
commented
Sep 24, 2019
Mark-Simulacrum
commented
Sep 24, 2019
For e.g. core or std, how much of a size increase is this? |
tomjakubowski
commented
Sep 24, 2019
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. |
bors
commented
Sep 25, 2019
☔ 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%. |
tomjakubowski
commented
Sep 26, 2019
The extra bytes come from adding a path for this variant: https://doc.rust-lang.org/nightly/std/collections/enum.TryReserveError.html#variant.AllocError |
Mark-Simulacrum
commented
Sep 26, 2019
That size increase looks entirely reasonable :) Thanks for investigating! |
Ping from triage. |
JohnCSimon
commented
Oct 12, 2019
Pinging again from triage. |
joelpalmer
commented
Oct 21, 2019
Ping from Triage: Closing due to inactivity. @tomjakubowski please reopen with any updates. Thanks for the PR. |
…-search, r=kinnison Struct variant field search Fixesrust-lang#16017. Reopening of rust-lang#64724. cc @tomjakubowski cc @ollie27 r? @kinnison
…-search, r=kinnison Struct variant field search Fixesrust-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
pathsentries 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
pathstable, 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
pathstable and re-constructs the URL tothe field's anchor on the enum documentation page.
closes#16017