1 // Tests that array sizes that depend on const-params are checked using `ConstEvaluatable`.
4 #![cfg_attr(full, feature(generic_const_exprs, adt_const_params))]
5 #![cfg_attr(full, allow(incomplete_features))]
8 struct ArithArrayLen<const N: usize>([u32; 0 + N]);
9 //[full]~^ ERROR unconstrained generic constant
10 //[min]~^^ ERROR generic parameters may not be used in const operations
12 #[derive(PartialEq, Eq)]
17 struct B<const CFG: Config> {
18 //[min]~^ ERROR `Config` is forbidden
19 arr: [u8; CFG.arr_size],
20 //[full]~^ ERROR overly complex generic constant
21 //[min]~^^ ERROR generic parameters may not be used in const operations
24 const C: Config = Config { arr_size: 5 };
27 let b = B::<C> { arr: [1, 2, 3, 4, 5] };
28 assert_eq!(b.arr.len(), 5);