Skip to content

Conversation

lolbinarycat
Copy link
Contributor

@lolbinarycat lolbinarycat commented Aug 26, 2025

fixes #138251

cc @notriddle

@rustbot rustbot added A-rustdoc-search Area: Rustdoc's search feature S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Aug 26, 2025
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 738dcc9 to 8444219 Compare August 26, 2025 19:35
@lolbinarycat
Copy link
Contributor Author

sometimes traitParent is not set properly for cross-crate implementations (eg. alloc::str::Bytes::last is not getting linked to Iterator::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.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat
Copy link
Contributor Author

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.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 8444219 to 0574e11 Compare August 30, 2025 20:21
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 0574e11 to 0c19f15 Compare August 30, 2025 20:45
@lolbinarycat
Copy link
Contributor Author

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.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 0c19f15 to a78352a Compare August 30, 2025 20:56
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat
Copy link
Contributor Author

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.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from a78352a to 2cf6317 Compare August 31, 2025 03:19
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat

This comment was marked as resolved.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 25836ae to 8f00bd5 Compare September 5, 2025 17:47
@lolbinarycat lolbinarycat marked this pull request as ready for review September 5, 2025 19:04
@rustbot
Copy link
Collaborator

rustbot commented Sep 5, 2025

r? @notriddle

rustbot has assigned @notriddle.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 5, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 5, 2025

Some changes occurred in GUI tests.

cc @GuillaumeGomez

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @jsha, @lolbinarycat

@lolbinarycat lolbinarycat changed the title WIP: don't show multiple instances of the same trait item in search If a trait item appears in rustdoc search, hide the corrosponding impl items Sep 5, 2025
@bors
Copy link
Collaborator

bors commented Sep 19, 2025

☔ The latest upstream changes (presumably #146700) made this pull request unmergeable. Please resolve the merge conflicts.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 8f00bd5 to a45a03c Compare September 20, 2025 19:43
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from a45a03c to 8f00bd5 Compare September 20, 2025 20:09
@rustbot

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 8f00bd5 to b297e37 Compare September 21, 2025 17:44
@rustbot
Copy link
Collaborator

rustbot commented Sep 21, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

} else {
// FIXME: this is `O(n*m)` because we're repeatedly
// shifting with Array.splice, but could be `O(n+m)` if
// we did the shifting manually in a more clever way.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it might be worth doing right away? Considering we're trying to improve the search performance (and we don't have a common way to test it ><), it'd be nice to know exactly the impact of this code to know if we should care or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea if it's worth it, but I'd be happy to implement it, since its an interesting algorithm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try to check in your web browser the amount of time this function takes? They have nice performance recording tools, that would give already a pretty good idea. If it takes like 1% of the total, it's not really worth it.

@GuillaumeGomez
Copy link
Member

There isn't a test to ensure that items are hidden right? Or did I miss it?

@lolbinarycat
Copy link
Contributor Author

There is no test currently, I will add one.

@lolbinarycat lolbinarycat added the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 21, 2025
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from b9e60a2 to 84a6282 Compare September 22, 2025 17:12
Comment on lines 2662 to 2713
// FIXME: this is `O(n*m)` because we're repeatedly
// shifting with Array.splice, but could be `O(n+m)` if
// we did the shifting manually in a more clever way.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to bring up MAX_RESULTS, which means n can never exceed 20.

define-function: (
"check-search-color",
[
theme, count_color, desc_color, path_color, bottom_border_color, keyword_color,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. Why is this being removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not, it's being moved to check-alias. This unit test seemed really unreliable, and honestly I'm not entirely sure how it was passing in the first place.

@lolbinarycat lolbinarycat force-pushed the rustdoc-search-trait-parent branch from 84a6282 to 1adb51f Compare September 27, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-search Area: Rustdoc's search feature relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blanket impls cause bloated search results in rustdoc
6 participants