rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.91k stars 12.68k forks source link

rustdoc converts byte literal discriminants into decimal numbers #128347

Open clarfonthey opened 2 months ago

clarfonthey commented 2 months ago

For some code that generates my command prompt, I use a single ASCII character for the discriminant of an enum:

pub enum Permissions {
    Guest = b'%',
    User = b'$',
    System = b'@',
    Absolute = b'#',
}

However, rustdoc displays this as:

pub enum Permissions {
    Guest = 37,
    User = 36,
    System = 64,
    Absolute = 35,
}

Personally, I think that rustdoc should try to display the literal as it was originally written, rather than converting it to a plain integer.

Meta

rustdoc --version --verbose:

rustdoc 1.81.0-nightly (9057c3ffe 2024-07-19)
binary: rustdoc
commit-hash: 9057c3ffec44926d5e149dc13ff3ce1613b69cce
commit-date: 2024-07-19
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
veera-sivarajan commented 2 months ago

@rustbot label -needs-triage +T-rustdoc