Add regression test for const generic ICE in #72819

Closes #72819
This commit is contained in:
Ayaz Hafiz 2020-06-06 11:44:28 -07:00
parent 118b50524b
commit 568cc22c3d
No known key found for this signature in database
GPG Key ID: B443F7A3030C9AED
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#![feature(const_generics)]
#![allow(incomplete_features)]
struct Arr<const N: usize>
where Assert::<{N < usize::max_value() / 2}>: IsTrue, //~ ERROR constant expression depends on a generic parameter
{
}
enum Assert<const CHECK: bool> {}
trait IsTrue {}
impl IsTrue for Assert<true> {}
fn main() {
let x: Arr<{usize::max_value()}> = Arr {};
}

View File

@ -0,0 +1,10 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-72819-generic-in-const-eval.rs:4:47
|
LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,
| ^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error