-
Notifications
You must be signed in to change notification settings - Fork 13.7k
WIP: don't show multiple instances of the same trait item in search #145898
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
WIP: don't show multiple instances of the same trait item in search #145898
Conversation
This comment has been minimized.
This comment has been minimized.
738dcc9
to
8444219
Compare
sometimes traitParent is not set properly for cross-crate implementations (eg.
alloc::str::Bytes::last
is not getting linked toIterator::last
).
this has been fixed (and removed from the PR description), i just needed to also be checking Cache::external_paths
when resolving trait_parent_idx
.
This comment has been minimized.
This comment has been minimized.
Right, I just remembered why my original design had its own deduplication pass, instead of leveraging the existing deduplication pass:
if the user searches for char::from
, we should show them both ascii::Char::from
and char::from
. its only when a search matches the actual trait item (in this case, From::from
) where we should perform this deduplication.
8444219
to
0574e11
Compare
This comment has been minimized.
This comment has been minimized.
0574e11
to
0c19f15
Compare
I believe I managed to get it working using notriddle's idea for how the search index data should be structured, but with my original idea of having two deduplication passes.
This comment has been minimized.
This comment has been minimized.
0c19f15
to
a78352a
Compare
This comment has been minimized.
This comment has been minimized.
ok so apparently some impls for unnamable traits get lowered and then filtered out later? which seems mildly wasteful but ig in the meantime i need to remove this debug assertion.
for example, if we're showing `Iterator::next`, we don't need to also show `Range::next` in the results.
a78352a
to
2cf6317
Compare
This comment has been minimized.
This comment has been minimized.
we need a new regression test for #78724 now.
The job x86_64-gnu-tools
failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
F (141/141)
/checkout/tests/rustdoc-gui/search-result-color.goml search-result-color... FAILED
[ERROR] `tests/rustdoc-gui/search-result-color.goml` line 24
from `tests/rustdoc-gui/search-result-color.goml` line 157: `//*[@class='desc'][normalize-space()='Just a normal struct.']` not found: for command `assert-css: (
"//*[@class='desc'][normalize-space()='Just a normal struct.']",
{"color": |desc_color|},
)`
[ERROR] `tests/rustdoc-gui/search-result-color.goml` line 101
from `tests/rustdoc-gui/search-result-color.goml` line 157: `//*[@class='desc'][normalize-space()='Just a normal struct.']` not found: for command `move-cursor-to: "//*[@class='desc'][normalize-space()='Just a normal struct.']"`
/checkout/tests/rustdoc-gui/search-tab.goml search-tab... FAILED
[ERROR] `tests/rustdoc-gui/search-tab.goml` line 82: The following errors happened: [` (22) ` isn't equal to ` (27) `]: for command `assert-text: ("#search-tabs > button:nth-child(1) > .count", " (27) ")`
Error: ()
Bootstrap failed while executing `test tests/rustdoc-gui --stage 2 --test-args --jobs 1`
Build completed unsuccessfully in 0:04:37
local time: Tue Sep 2 17:49:35 UTC 2025
Uh oh!
There was an error while loading. Please reload this page.
fixes #138251
cc @notriddle
current known issues:
-> Option
, it showsstd::char::Lowercase::last
as its representative ofIterator::last
)