Rollup merge of #61344 - varkor:const-failed-to-life-ice, r=Centril
Add regression test for const generics ICE Closes https://github.com/rust-lang/rust/issues/60879.
This commit is contained in:
commit
2106d57c35
2 changed files with 24 additions and 0 deletions
18
src/test/ui/const-generics/const-generic-array-wrapper.rs
Normal file
18
src/test/ui/const-generics/const-generic-array-wrapper.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
struct Foo<T, const N: usize>([T; {N}]);
|
||||
|
||||
impl<T, const N: usize> Foo<T, {N}> {
|
||||
fn foo(&self) -> usize {
|
||||
{N}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo = Foo([0u32; 21]);
|
||||
assert_eq!(foo.0, [0u32; 21]);
|
||||
assert_eq!(foo.foo(), 21);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/const-generic-array-wrapper.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue