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.
Rollup merge of rust-lang#75888 - GuillaumeGomez:trait-impl-assoc-con…
…st-doc-alias, r=ollie27 Add check for doc alias on assoc const in trait impl Fixes rust-lang#73721. r? @ollie27
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
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
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 | ||
|