Skip to content

Rustdoc: overflowing supertraits should wrap, not scroll #127398

Closed
@tgross35

Description

@tgross35

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions