Open
Description
const VALUE: usize = 1;
type Ty = ();
pub trait Foo<const N: usize = VALUE, T = Ty> {}
Rustdoc generates the following pseudocode for this trait’s documentation page:
pub trait Foo<const N: usize = VALUE, T = ()> { }
This seems inconsistent to me: non-public constants should be replaced with their value just like non-public type aliases are, because crates should be free to have aliases for their own things privately without affecting the public view.
Another case is when a public constant uses a private constant; in that case, the private constant is named and the final value is. I’m not sure whether that’s good, but it at least answers the question of what the value is.
Meta
rustc --version --verbose
:
rustc 1.82.0-nightly (41dd149fd 2024-08-11)
binary: rustc
commit-hash: 41dd149fd6a6a06795fc6b9f54cb49af2f61775f
commit-date: 2024-08-11
host: x86_64-apple-darwin
release: 1.82.0-nightly
LLVM version: 19.1.0
@rustbot label +T-rustdoc