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