Skip to content

Commit

Permalink
Add test for doc alias on associated const in trait impls
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 3, 2020
1 parent 6e43ff5 commit b61eab5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/rustdoc-ui/doc-alias-assoc-const.rs
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
}
}
8 changes: 8 additions & 0 deletions src/test/rustdoc-ui/doc-alias-assoc-const.stderr
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

0 comments on commit b61eab5

Please sign in to comment.