Skip to content

Commit 568cc22

Browse files
committed
Add regression test for const generic ICE in #72819
Closes #72819
1 parent 118b505 commit 568cc22

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
struct Arr<const N: usize>
4+
where Assert::<{N < usize::max_value() / 2}>: IsTrue, //~ ERROR constant expression depends on a generic parameter
5+
{
6+
}
7+
8+
enum Assert<const CHECK: bool> {}
9+
10+
trait IsTrue {}
11+
12+
impl IsTrue for Assert<true> {}
13+
14+
fn main() {
15+
let x: Arr<{usize::max_value()}> = Arr {};
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: constant expression depends on a generic parameter
2+
--> $DIR/issue-72819-generic-in-const-eval.rs:4:47
3+
|
4+
LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,
5+
| ^^^^^^
6+
|
7+
= note: this may fail depending on what value the parameter takes
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)