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