Skip to content

Commit 0f02522

Browse files
committed
Add regression test for #61522
1 parent 61cc892 commit 0f02522

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(const_generics)]
2+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
3+
4+
pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
5+
//~^ ERROR constant expression depends on a generic parameter
6+
7+
impl<const COUNT: usize> MyArray<COUNT> {
8+
fn inner(&self) -> &[u8; COUNT + 1] {
9+
//~^ ERROR constant expression depends on a generic parameter
10+
&self.0
11+
}
12+
}
13+
14+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/issue-61522-array-len-succ.rs:1:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
9+
error: constant expression depends on a generic parameter
10+
--> $DIR/issue-61522-array-len-succ.rs:4:40
11+
|
12+
LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
13+
| ^^^^^^^^^^^^^^^
14+
|
15+
= note: this may fail depending on what value the parameter takes
16+
17+
error: constant expression depends on a generic parameter
18+
--> $DIR/issue-61522-array-len-succ.rs:8:24
19+
|
20+
LL | fn inner(&self) -> &[u8; COUNT + 1] {
21+
| ^^^^^^^^^^^^^^^^
22+
|
23+
= note: this may fail depending on what value the parameter takes
24+
25+
error: aborting due to 2 previous errors
26+

0 commit comments

Comments
 (0)