Skip to content

rustdoc: where-clauses on tuple & unit structs and on assoc tys are weirdly styled #112901

Open
@fmease

Description

@fmease

The styling of where-clauses on tuple & unit structs and on assoc tys weirdly differs from those on other items (structs, enums, unions, functions, impl blocks etc.) in that they don't have a smaller fonts size and are indented by 9 instead of 4 spaces (more precisely: for associated types it's 3 instead of 4 inside the .item-decl of the trait but 9 instead of 4 everywhere else).

Tuple Structs

pub struct A<T>(T)
where
    T: Copy;

is rendered as

Screenshot 2023-06-21 at 18-54-30 A in tup - Rust

Compare that to

pub struct B<T>
where
    T: Copy,
{
    x: T,
}

Screenshot 2023-06-21 at 18-55-31 B in tup - Rust

Unit Structs

#![feature(trivial_bounds)]

pub struct S
where
    String: Clone;

Screenshot 2023-06-21 at 19-07-44 S in tup - Rust

Associated Types

pub struct S;

pub trait Tr {
    type F<T>
    where
        T: Clone;
}

impl Tr for S {
    type F<T> = T where T: Clone;
}

Inside the .item-decl of the trait (3 spaces, big):

Screenshot 2023-06-21 at 20-14-21 Tr in nx - Rust

In section Required Associated Types on the page of the trait (9 spaces):

Screenshot 2023-06-21 at 20-12-24 Tr in nx - Rust

On the implementer's page (9 spaces, big):

Screenshot 2023-06-21 at 20-15-58 S in nx - Rust

@rustbot label C-bug T-rustdoc A-rustdoc-ui

Metadata

Metadata

Assignees

Labels

A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions