Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc: overflowing supertraits should wrap, not scroll #127398

Closed
tgross35 opened this issue Jul 5, 2024 · 1 comment · Fixed by #127975
Closed

Rustdoc: overflowing supertraits should wrap, not scroll #127398

tgross35 opened this issue Jul 5, 2024 · 1 comment · Fixed by #127975
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) 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.

Comments

@tgross35
Copy link
Contributor

tgross35 commented Jul 5, 2024

See e.g. https://docs.rs/num/latest/num/traits/int/trait.PrimInt.html, there are four horizontal pages listing the supertraits:

image image image image

By contrast, rustfmt splits these into separate lines:

pub trait PrimInt:
    Sized
    + Copy
    + Num
    + NumCast
    + Bounded
    + PartialOrd
    + Ord
    + Eq
    + Not<Output = Self>
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + BitXor<Output = Self>
    + Shl<usize, Output = Self>
    + Shr<usize, Output = Self>
    + CheckedAdd<Output = Self>
    + CheckedSub<Output = Self>
    + CheckedMul<Output = Self>
    + CheckedDiv<Output = Self>
    + Saturating
{
    /* ... */
}

Splitting into lines would make this easier to navigate. If vertical space consumption is a concern, maybe lengthy supertrait lists could be made collapsible (like methods currently are).

Somewhat related to #107283, but this seems to be a different variant of that problem.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 5, 2024
@tgross35
Copy link
Contributor Author

tgross35 commented Jul 5, 2024

@rustbot label +T-rustdoc +T-rustdoc-frontend +A-rustdoc-ui -needs-triage

@rustbot rustbot added A-rustdoc-ui Area: Rustdoc UI (generated HTML) 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. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 5, 2024
@bors bors closed this as completed in 17aaba7 Jul 21, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 21, 2024
Rollup merge of rust-lang#127975 - GuillaumeGomez:fix-trait-bounds-display, r=notriddle

Fix trait bounds display

Fixes rust-lang#127398.

I took a simple rule: if there are more than two bounds, we display them like rustfmt.

Before this PR:

![Screenshot from 2024-07-19 17-38-59](https://github.com/user-attachments/assets/4162b57e-7ebb-48f9-a3a1-25e443c140cb)

After this PR:

![Screenshot from 2024-07-19 17-39-09](https://github.com/user-attachments/assets/a3ba22dd-5f34-45d0-ad9d-0cdf89dc509c)

r? `@notriddle`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) 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 a pull request may close this issue.

2 participants