-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Open
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
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
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.