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
This commit is contained in:
commit
ec9d5241f7
32
src/test/ui/const-generics/issues/issue-72787.rs
Normal file
32
src/test/ui/const-generics/issues/issue-72787.rs
Normal file
@ -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() {}
|
42
src/test/ui/const-generics/issues/issue-72787.stderr
Normal file
42
src/test/ui/const-generics/issues/issue-72787.stderr
Normal file
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user