Skip to content

Commit 0a77c8c

Browse files
authored
Rollup merge of #73070 - ayazhafiz:i/72819, r=nikomatsakis
Add regression test for const generic ICE in #72819 Closes #72819
2 parents e1cd8c4 + 2981395 commit 0a77c8c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Regression test for #72819: ICE due to failure in resolving the const generic in `Arr`'s type
2+
// bounds.
3+
4+
#![feature(const_generics)]
5+
#![allow(incomplete_features)]
6+
struct Arr<const N: usize>
7+
where Assert::<{N < usize::max_value() / 2}>: IsTrue,
8+
//~^ ERROR constant expression depends on a generic parameter
9+
{
10+
}
11+
12+
enum Assert<const CHECK: bool> {}
13+
14+
trait IsTrue {}
15+
16+
impl IsTrue for Assert<true> {}
17+
18+
fn main() {
19+
let x: Arr<{usize::max_value()}> = Arr {};
20+
}
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:7: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)