Skip to content

Inconsistent spacing between constants in rustdoc #105868

Closed
@y21

Description

@y21

I'm not sure if this is a bug or intended behavior, but it seems like the spacing between constants is off if the constant defines a code block.

You can see this in the stdlib documentation on various types, like here on the type i32:

image

In 1.65, it looked like this (link):
image

I can also reproduce this locally: if I run cargo doc --open on this code:

pub struct Foo;
impl Foo {
    /// ```rust
    /// use bug::Foo;
    /// ```
    pub const BAR: u32 = 123;
    pub const BAZ: u32 = 456;
    pub const BAZ2: u32 = 789;
}

This happens:

image

The constant BAZ has less padding than the other constants.

Meta

❯ rustc --version --verbose
rustc 1.66.0-nightly (5c8bff74b 2022-10-21)
binary: rustc
commit-hash: 5c8bff74bc1c52bef0c79f3689bb227f51f3e82d
commit-date: 2022-10-21
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2

Metadata

Metadata

Assignees

No one assigned

    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