Open
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