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