Skip to content

Commit 22ee68d

Browse files
committed
Auto merge of #75166 - JulianKnodt:i64494, r=lcnr
Add regression test for #64494 Add regression test to indicate if this compilation ever succeeds. Fixes #64494 r? @lcnr
2 parents 52b179b + 7dd1b6a commit 22ee68d

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
4+
trait Foo {
5+
const VAL: usize;
6+
}
7+
8+
trait MyTrait {}
9+
10+
trait True {}
11+
struct Is<const T: bool>;
12+
impl True for Is<{true}> {}
13+
14+
impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
15+
//~^ ERROR constant expression depends on a generic parameter
16+
impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
17+
//~^ ERROR constant expression depends on a generic parameter
18+
19+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: constant expression depends on a generic parameter
2+
--> $DIR/issue-64494.rs:14:53
3+
|
4+
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
5+
| ^^^^
6+
|
7+
= note: this may fail depending on what value the parameter takes
8+
9+
error: constant expression depends on a generic parameter
10+
--> $DIR/issue-64494.rs:16:53
11+
|
12+
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
13+
| ^^^^
14+
|
15+
= note: this may fail depending on what value the parameter takes
16+
17+
error: aborting due to 2 previous errors
18+

0 commit comments

Comments
 (0)