Skip to content

[rustdoc] Remove special-case preventing Destruct trait to be displayed in generic bounds#151515

Open
GuillaumeGomez wants to merge 1 commit intorust-lang:mainfrom
GuillaumeGomez:destruct-trait-bounds
Open

[rustdoc] Remove special-case preventing Destruct trait to be displayed in generic bounds#151515
GuillaumeGomez wants to merge 1 commit intorust-lang:mainfrom
GuillaumeGomez:destruct-trait-bounds

Conversation

@GuillaumeGomez
Copy link
Copy Markdown
Member

Fixes #151502.

Since you're the one who added this code (I think, based on what I found with git blame), I'll set you as reviewer @oli-obk.

r? @oli-obk

@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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jan 22, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jan 22, 2026

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

@clubby789
Copy link
Copy Markdown
Contributor

I think that's the result of some refactoring; this was introduced in #92229, so cc @fee1-dead

@@ -226,13 +226,6 @@ fn clean_generic_bound<'tcx>(
Some(match bound {
hir::GenericBound::Outlives(lt) => GenericBound::Outlives(clean_lifetime(lt, cx)),
hir::GenericBound::Trait(t) => {
Copy link
Copy Markdown
Member

@fmease fmease Jan 22, 2026

Choose a reason for hiding this comment

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

The point still stands though: T: Destruct is meaningless and only [const] Destruct and const Destruct are meaningful but we intentionally don't render const trait bound modifiers in rustdoc for now to avoid confusing readers of libstd docs on stable.

Therefore, with my PG-const-traits hat on, I don't agree with this change. The real (temporary) fix would be to drop empty HIR where-clauses (following the [const] Destruct removal).

Moreover, under the current version of your PR, you start rendering T: Destruct (no-op bound) in the local case (e.g., core::mem::drop) but not in the inlined cross-crate re-export case (e.g., std::mem::drop).

Side note: I'm of the opinion that we should actually render const trait bound modifiers by default for a given crate (that enables CTI) and introduce an internal attribute for core & std to suppress them. See also this Zulip discussion.

@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 22, 2026
@fmease fmease added the PG-const-traits Project group: Const traits label Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PG-const-traits Project group: Const traits 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[const] Destruct bounds aren't rendered

5 participants