Skip to content

Conversation

@GuillaumeGomez
Copy link
Member

This PR adds a new JS setting which allows the JS to hide deprecated items. This is especially useful for crates like std which accumulates deprecated items but never removes them.

Nicely enough, the "deprecation" information was already in the search index, meaning I didn't need to change anything there. Before this PR, it was only used to make the deprecated items rank lower. Well now it's also used to generate an extra CSS class, allowing the JS setting to work.

This is taking over #149551.

This feature got approved by the rustdoc team in the meeting of december.

You can give it a try here.

r? @lolbinarycat

@rustbot
Copy link
Collaborator

rustbot commented Jan 13, 2026

Some changes occurred in HTML/CSS/JS.

cc @lolbinarycat

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend A-rustdoc-search Area: Rustdoc's search feature 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. labels Jan 13, 2026
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the hide-deprecated-items branch 2 times, most recently from 1fe45dd to 4622f64 Compare January 14, 2026 13:54
@rustbot rustbot added the A-rustdoc-js Area: Rustdoc's JS front-end label Jan 14, 2026
@rustbot

This comment has been minimized.

1 similar comment
@rustbot

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

Rebased so it includes #151053, which hopefully should fix the flakyness issue.

@lolbinarycat lolbinarycat added the relnotes Marks issues that should be documented in the release notes of the next release. label Jan 14, 2026
@lolbinarycat
Copy link
Contributor

This made me realize that we use the word "hide" inconsistently in this settings panel, sometimes we mean "collapse, with a button to expand it again", and sometimes we mean "act like it doesn't exist at all".

I think the former should be referred to with the verb "Collapse", I think that would make things seem a bit less inconsistent.

Copy link
Contributor

@lolbinarycat lolbinarycat left a comment

Choose a reason for hiding this comment

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

Logic looks sound, but there's a bunch of stuff that I think could be written either more readably or more compactly, and there's a few more test cases I would like to see.

View changes since this review

@lolbinarycat
Copy link
Contributor

@rustbot author

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

rustbot commented Jan 14, 2026

This PR was rebased onto a different main 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.

@GuillaumeGomez
Copy link
Member Author

@rustbot ready

@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 Jan 16, 2026
Copy link
Contributor

@lolbinarycat lolbinarycat left a comment

Choose a reason for hiding this comment

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

Code looks much better (better than what I would've written, even), but I'm still not 100% satisfied with the tests.

View changes since this review

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Jan 17, 2026

Applied parts of the suggestions.

@lolbinarycat
Copy link
Contributor

One final bit of test coverage I would like to see: when searching future_deprecated_fn with "Hide deprecated items" enabled, it should not be hidden. It's a small thing, but it would be nice to make sure the handling of items with pending deprecation has consistency across search and non-search contexts.

… value in the end, no need to keep it around. Also: takes into account "is_in_effect"
Improve the `perform-search` goml function to work when search is already open
@lolbinarycat
Copy link
Contributor

Thanks!

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 19, 2026

📌 Commit aef8112 has been approved by lolbinarycat

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 19, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 20, 2026
Add new "hide deprecated items" setting in rustdoc

This PR adds a new JS setting which allows the JS to hide deprecated items. This is especially useful for crates like `std` which accumulates deprecated items but never removes them.

Nicely enough, the "deprecation" information was already in the search index, meaning I didn't need to change anything there. Before this PR, it was only used to make the deprecated items rank lower. Well now it's also used to generate an extra CSS class, allowing the JS setting to work.

This is taking over rust-lang#149551.

This feature got approved by the rustdoc team in the [meeting of december](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562553156).

You can give it a try [here](https://rustdoc.crud.net/imperio/hide-deprecated-items/foo/index.html).

r? @lolbinarycat
rust-bors bot pushed a commit that referenced this pull request Jan 20, 2026
Rollup of 8 pull requests

Successful merges:

 - #149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions)
 - #150071 (Add dist step for Enzyme)
 - #150288 (Add scalar support for offload)
 - #151091 (Add new "hide deprecated items" setting in rustdoc)
 - #151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`)
 - #151375 (Fix terminal  width dependent tests)
 - #151384 (add basic `TokenStream` api tests)
 - #151391 (rustc-dev-guide subtree update)

r? @ghost
@rust-bors rust-bors bot merged commit 88df8fd into rust-lang:main Jan 20, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Jan 20, 2026
rust-timer added a commit that referenced this pull request Jan 20, 2026
Rollup merge of #151091 - hide-deprecated-items, r=lolbinarycat

Add new "hide deprecated items" setting in rustdoc

This PR adds a new JS setting which allows the JS to hide deprecated items. This is especially useful for crates like `std` which accumulates deprecated items but never removes them.

Nicely enough, the "deprecation" information was already in the search index, meaning I didn't need to change anything there. Before this PR, it was only used to make the deprecated items rank lower. Well now it's also used to generate an extra CSS class, allowing the JS setting to work.

This is taking over #149551.

This feature got approved by the rustdoc team in the [meeting of december](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562553156).

You can give it a try [here](https://rustdoc.crud.net/imperio/hide-deprecated-items/foo/index.html).

r? @lolbinarycat
@GuillaumeGomez
Copy link
Member Author

Thanks to this check, I discovered that the IndexItem::deprecation field for the search items didn't check for is_in_effect, so I reworked it a bit: now it's a boolean and it uses the Item::is_deprecated method instead, which does check for is_in_effect.

@GuillaumeGomez GuillaumeGomez deleted the hide-deprecated-items branch January 20, 2026 13:09
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jan 20, 2026
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions)
 - rust-lang/rust#150071 (Add dist step for Enzyme)
 - rust-lang/rust#150288 (Add scalar support for offload)
 - rust-lang/rust#151091 (Add new "hide deprecated items" setting in rustdoc)
 - rust-lang/rust#151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`)
 - rust-lang/rust#151375 (Fix terminal  width dependent tests)
 - rust-lang/rust#151384 (add basic `TokenStream` api tests)
 - rust-lang/rust#151391 (rustc-dev-guide subtree update)

r? @ghost
@Zalathar
Copy link
Member

Be advised of some doc perf regressions in rollup:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants