Skip to content

Commit 4643a45

Browse files
authored
Rollup merge of #61344 - varkor:const-failed-to-life-ice, r=Centril
Add regression test for const generics ICE Closes #60879.
2 parents 30b3139 + 0fdd419 commit 4643a45

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// run-pass
2+
3+
#![feature(const_generics)]
4+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+
struct Foo<T, const N: usize>([T; {N}]);
7+
8+
impl<T, const N: usize> Foo<T, {N}> {
9+
fn foo(&self) -> usize {
10+
{N}
11+
}
12+
}
13+
14+
fn main() {
15+
let foo = Foo([0u32; 21]);
16+
assert_eq!(foo.0, [0u32; 21]);
17+
assert_eq!(foo.foo(), 21);
18+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/const-generic-array-wrapper.rs:3:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+

0 commit comments

Comments
 (0)