2019-04-17 14:00:35 -05:00
|
|
|
const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
|
2022-06-12 10:46:57 -05:00
|
|
|
//~^ ERROR E0790
|
2019-04-17 14:00:35 -05:00
|
|
|
|
|
|
|
trait Tt {
|
|
|
|
const fn const_val<T: Sized>() -> usize {
|
2020-02-11 01:19:21 -06:00
|
|
|
//~^ ERROR functions in traits cannot be declared const
|
2019-04-17 14:00:35 -05:00
|
|
|
core::mem::size_of::<T>()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
|
|
|
|
z
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _ = f([1f32; ARR_LEN]);
|
|
|
|
}
|