-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
2 changed files
with
37 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,19 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Foo { | ||
const VAL: usize; | ||
} | ||
|
||
trait MyTrait {} | ||
|
||
trait True {} | ||
struct Is<const T: bool>; | ||
impl True for Is<{true}> {} | ||
|
||
impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {} | ||
//~^ ERROR constant expression depends on a generic parameter | ||
impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {} | ||
//~^ ERROR constant expression depends on a generic parameter | ||
|
||
fn main() {} |
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 @@ | ||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-64494.rs:14:53 | ||
| | ||
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {} | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-64494.rs:16:53 | ||
| | ||
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {} | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: aborting due to 2 previous errors | ||
|