2021-08-27 11:04:57 -05:00
|
|
|
// [full] check-pass
|
2020-09-09 06:28:41 -05:00
|
|
|
// revisions: full min
|
2021-08-27 11:04:57 -05:00
|
|
|
#![cfg_attr(full, feature(generic_const_exprs))]
|
2020-09-09 06:28:41 -05:00
|
|
|
#![cfg_attr(full, allow(incomplete_features))]
|
2020-08-04 17:14:27 -05:00
|
|
|
|
|
|
|
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
|
2021-08-27 11:04:57 -05:00
|
|
|
//[min]~^ Error generic parameters may not be used in const operations
|
2020-10-12 16:27:59 -05:00
|
|
|
//[min]~| Error generic parameters may not be used in const operations
|
2020-08-04 17:14:27 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
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,
|
2021-08-27 11:04:57 -05:00
|
|
|
//[min]~^ Error generic parameters may not be used in const operations
|
2020-10-12 16:27:59 -05:00
|
|
|
//[min]~| Error generic parameters may not be used in const operations
|
2020-08-04 17:14:27 -05:00
|
|
|
// Condition<{ 8 - I <= 8 - J }>: True,
|
|
|
|
{
|
|
|
|
fn print() {
|
|
|
|
println!("I {} J {}", I, J);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|