Skip to content

Conversation

@Saphereye
Copy link

@Saphereye Saphereye commented Dec 2, 2025

Fixes: #149483

This PR introduces a flag that hides all deprecated items when generating docs.

For example, given the following code:

#![allow(unused)]
pub struct Visible;

#[deprecated(since = "1.2.3", note = "use Visible instead")]
pub struct OldType;

pub mod m {
    #[deprecated]
    pub fn old_fn() {}
    pub fn new_fn() {}
}

#[deprecated]
pub fn legacy_api() {}

pub fn modern_api() {}

And on generating the docs:

Original After Edits
image image but the symbols still exists, so its still searchable image

Edits:

  • changed behavior from removing symbols to just hiding them

@rustbot rustbot added 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. labels Dec 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

r? @GuillaumeGomez

rustbot has assigned @GuillaumeGomez.
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

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member

Instead of not generating items, I think adding a setting to hide them would be better.

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Dec 3, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Saphereye
Copy link
Author

Saphereye commented Dec 6, 2025

Added a flag to hide unstable items (based on feedback in the parent issue). I also tried adding a corresponding option in the settings panel, but ran into two issues:

  1. Not all elements can be reliably identified as unstable or deprecated via existing tags, so they still appear in places like the sidebar. I experimented with injecting extra metadata into the generated nodes, but it felt hacky and would require adding the metadata to many places. In the future if we were to add more hiding flags this would bloat the docs(?)

  2. I couldn’t make the settings option persist and apply responsively across pages. Enabling it on one page wouldn’t carry over to the next, and elements only refreshed to the hidden state after reopening the settings panel.

I will check this out more but will keep the flags for now.

@rust-log-analyzer

This comment has been minimized.

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

Labels

A-run-make Area: port run-make Makefiles to rmake.rs 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.

[rustdoc] Add option to hide deprecated items

4 participants