rust-lang / rust-lang/rust

`[const] Destruct` bounds aren't rendered

Open
#151,502 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-discussion T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Tracking issue: #133214

[const] Destruct bounds are rendered as an empty bounds list, which is exposed by some const std functions.

Image

This is not the case for other [const] trait bounds:

#![feature(const_trait_impl)]

pub const trait Foo {}

pub const fn f<T>(_: &T)
where T: [const] Foo {} 
Image

While this is a deliberate choice https://github.com/rust-lang/rust/blob/d29e4783dff30f9526eeba3929ebfe86c00c9dad/src/librustdoc/clean/mod.rs#L229-L234

I think this results in a confusing render, and that it would be better to display it or omit the where T: entirely here

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/librustdoc/clean/mod.rs at the linked lines 229-234, then reproduce the rustdoc output with the provided const-trait examples. Compare the [const] Destruct rendering with the other [const] bound, and consider the issue's two expected outcomes: display the bound or omit the empty where T: clause.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.