-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-doc-aliasArea: `#[doc(alias)]`Area: `#[doc(alias)]`A-trait-systemArea: Trait systemArea: Trait systemC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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
I tried this code:
pub trait Trait {
const VALUE: u32;
}
pub struct Struct;
impl Trait for Struct {
#[doc(alias = "kValue")]
const VALUE: u32 = 42;
}
Similarly, I tried:
trait Trait {
type Value;
}
struct Struct;
impl Trait for Struct {
#[doc(alias = "ValueType")]
type Value = u32;
}
I expected to see this happen: the code to compile and searching kValue
or ValueType
in the docs to produce Struct::VALUE
or Struct::Value
respectively.
Instead, this happened: These failed to compile with the following errors:
error:
#[doc(alias = "...")]
isn't allowed on associated constant in trait implementation block
error:
#[doc(alias = "...")]
isn't allowed on type alias in implementation block
This is very surprising because:
#[doc(alias)]
works onfn
trait members in impl blocks.- Doc comments are allowed on associated constants and types in impl blocks.
Meta
rustc --version --verbose
:
rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-apple-darwin
release: 1.49.0
Hermitter and amab8901
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-doc-aliasArea: `#[doc(alias)]`Area: `#[doc(alias)]`A-trait-systemArea: Trait systemArea: Trait systemC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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.