]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/issue-54954.rs
Rollup merge of #106963 - compiler-errors:scope-expr-dupe, r=michaelwoerister
[rust.git] / tests / ui / consts / issue-54954.rs
1 const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
2 //~^ ERROR E0790
3
4 trait Tt {
5     const fn const_val<T: Sized>() -> usize {
6         //~^ ERROR functions in traits cannot be declared const
7         core::mem::size_of::<T>()
8     }
9 }
10
11 fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
12   //~^ constant
13   //~| constant
14     z
15 }
16
17 fn main() {
18     let _ = f([1f32; ARR_LEN]);
19 }