Skip to content

Commit

Permalink
Add regression test for rust-lang#47814
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Okushi <[email protected]>
  • Loading branch information
JohnTitor committed Dec 4, 2022
1 parent 2341517 commit c366129
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/ui/associated-consts/issue-47814.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
struct ArpIPv4<'a> {
s: &'a u8
}

impl<'a> ArpIPv4<'a> {
const LENGTH: usize = 20;

pub fn to_buffer() -> [u8; Self::LENGTH] {
//~^ ERROR: generic `Self` types are currently not permitted in anonymous constants
unimplemented!()
}
}

fn main() {}
14 changes: 14 additions & 0 deletions src/test/ui/associated-consts/issue-47814.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: generic `Self` types are currently not permitted in anonymous constants
--> $DIR/issue-47814.rs:8:32
|
LL | pub fn to_buffer() -> [u8; Self::LENGTH] {
| ^^^^
|
note: not a concrete type
--> $DIR/issue-47814.rs:5:10
|
LL | impl<'a> ArpIPv4<'a> {
| ^^^^^^^^^^^

error: aborting due to previous error

0 comments on commit c366129

Please sign in to comment.