forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for doc alias on associated const in trait impls
- Loading branch information
1 parent
6e43ff5
commit b61eab5
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#![feature(doc_alias)] | ||
#![feature(trait_alias)] | ||
|
||
pub struct Foo; | ||
|
||
pub trait Bar { | ||
const BAZ: u8; | ||
} | ||
|
||
impl Bar for Foo { | ||
#[doc(alias = "CONST_BAZ")] //~ ERROR | ||
const BAZ: u8 = 0; | ||
} | ||
|
||
impl Foo { | ||
#[doc(alias = "CONST_FOO")] // ok! | ||
pub const FOO: u8 = 0; | ||
|
||
pub fn bar() -> u8 { | ||
Self::FOO | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: `#[doc(alias = "...")]` isn't allowed on associated constant in trait implementation block | ||
--> $DIR/doc-alias-assoc-const.rs:11:11 | ||
| | ||
LL | #[doc(alias = "CONST_BAZ")] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|