2020-06-08 19:46:28 -05:00
|
|
|
// Regression test for #72819: ICE due to failure in resolving the const generic in `Arr`'s type
|
|
|
|
// bounds.
|
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-06-08 19:46:28 -05:00
|
|
|
|
2020-06-06 13:44:28 -05:00
|
|
|
struct Arr<const N: usize>
|
2020-10-24 18:21:40 -05:00
|
|
|
where Assert::<{N < usize::MAX / 2}>: IsTrue,
|
2021-08-27 11:04:57 -05:00
|
|
|
//[min]~^ ERROR generic parameters may not be used in const operations
|
2020-06-06 13:44:28 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Assert<const CHECK: bool> {}
|
|
|
|
|
|
|
|
trait IsTrue {}
|
|
|
|
|
|
|
|
impl IsTrue for Assert<true> {}
|
|
|
|
|
|
|
|
fn main() {
|
2020-10-24 18:21:40 -05:00
|
|
|
let x: Arr<{usize::MAX}> = Arr {};
|
2021-08-27 11:04:57 -05:00
|
|
|
//[full]~^ ERROR mismatched types
|
|
|
|
//[full]~| ERROR mismatched types
|
2020-06-06 13:44:28 -05:00
|
|
|
}
|