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 #75165 - JulianKnodt:i72787, r=lcnr
Add regression test for #72787 Add regression test for Issue #72787 Fixes #72787 ~~Still waiting on running tests locally to bless the error output~~ r? @lcnr
- Loading branch information
Showing
2 changed files
with
74 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,32 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
pub struct IsLessOrEqual<const LHS: u32, const RHS: u32>; | ||
pub struct Condition<const CONDITION: bool>; | ||
pub trait True {} | ||
|
||
impl<const LHS: u32, const RHS: u32> True for IsLessOrEqual<LHS, RHS> where | ||
Condition<{ LHS <= RHS }>: True | ||
//~^ Error constant expression depends on a generic parameter | ||
{ | ||
} | ||
impl True for Condition<true> {} | ||
|
||
struct S<const I: u32, const J: u32>; | ||
impl<const I: u32, const J: u32> S<I, J> | ||
where | ||
IsLessOrEqual<I, 8>: True, | ||
IsLessOrEqual<J, 8>: True, | ||
IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ||
//~^ Error constant expression depends on a generic parameter | ||
//~| Error constant expression depends on a generic parameter | ||
//~| Error constant expression depends on a generic parameter | ||
//~| Error constant expression depends on a generic parameter | ||
// Condition<{ 8 - I <= 8 - J }>: True, | ||
{ | ||
fn print() { | ||
println!("I {} J {}", I, J); | ||
} | ||
} | ||
|
||
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,42 @@ | ||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-72787.rs:9:32 | ||
| | ||
LL | Condition<{ LHS <= RHS }>: True | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-72787.rs:20:42 | ||
| | ||
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-72787.rs:20:42 | ||
| | ||
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-72787.rs:20:42 | ||
| | ||
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-72787.rs:20:42 | ||
| | ||
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: aborting due to 5 previous errors | ||
|