2020-09-09 06:28:41 -05:00
|
|
|
// revisions: full min
|
2020-03-12 19:03:58 -05:00
|
|
|
#![allow(incomplete_features)]
|
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-03-12 19:03:58 -05:00
|
|
|
|
|
|
|
trait HasSize {
|
|
|
|
const SIZE: usize;
|
|
|
|
}
|
|
|
|
|
2020-03-27 15:56:19 -05:00
|
|
|
impl<const X: usize> HasSize for ArrayHolder<X> {
|
2020-03-12 19:03:58 -05:00
|
|
|
const SIZE: usize = X;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ArrayHolder<const X: usize>([u32; X]);
|
|
|
|
|
2020-03-27 15:56:19 -05:00
|
|
|
impl<const X: usize> ArrayHolder<X> {
|
2020-03-12 19:03:58 -05:00
|
|
|
pub const fn new() -> Self {
|
|
|
|
ArrayHolder([0; Self::SIZE])
|
2021-08-27 11:04:57 -05:00
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//[full]~^^ ERROR unconstrained generic constant
|
|
|
|
//[min]~^^^ ERROR constant expression depends on a generic parameter
|
2020-03-12 19:03:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut array = ArrayHolder::new();
|
|
|
|
}
|