forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/test/ui/const-generics/const-generic-array-wrapper.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)] | ||
| ^^^^^^^^^^^^^^ | ||
|