Skip to content

Commit 2106d57

Browse files
authored
Rollup merge of rust-lang#61344 - varkor:const-failed-to-life-ice, r=Centril
Add regression test for const generics ICE Closes rust-lang#60879.
2 parents 860deae + 0fdd419 commit 2106d57

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
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+
}
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)