Skip to content

Commit b61eab5

Browse files
Add test for doc alias on associated const in trait impls
1 parent 6e43ff5 commit b61eab5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![feature(doc_alias)]
2+
#![feature(trait_alias)]
3+
4+
pub struct Foo;
5+
6+
pub trait Bar {
7+
const BAZ: u8;
8+
}
9+
10+
impl Bar for Foo {
11+
#[doc(alias = "CONST_BAZ")] //~ ERROR
12+
const BAZ: u8 = 0;
13+
}
14+
15+
impl Foo {
16+
#[doc(alias = "CONST_FOO")] // ok!
17+
pub const FOO: u8 = 0;
18+
19+
pub fn bar() -> u8 {
20+
Self::FOO
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: `#[doc(alias = "...")]` isn't allowed on associated constant in trait implementation block
2+
--> $DIR/doc-alias-assoc-const.rs:11:11
3+
|
4+
LL | #[doc(alias = "CONST_BAZ")]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)