]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/issue-54954.stderr
Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
[rust.git] / tests / ui / consts / issue-54954.stderr
1 error[E0379]: functions in traits cannot be declared const
2   --> $DIR/issue-54954.rs:5:5
3    |
4 LL |     const fn const_val<T: Sized>() -> usize {
5    |     ^^^^^ functions in traits cannot be const
6
7 error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
8   --> $DIR/issue-54954.rs:1:24
9    |
10 LL |   const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
11    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
12 ...
13 LL | /     const fn const_val<T: Sized>() -> usize {
14 LL | |
15 LL | |         core::mem::size_of::<T>()
16 LL | |     }
17    | |_____- `Tt::const_val` defined here
18
19 note: erroneous constant used
20   --> $DIR/issue-54954.rs:11:15
21    |
22 LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
23    |               ^^^^^^^
24
25 note: erroneous constant used
26   --> $DIR/issue-54954.rs:11:34
27    |
28 LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
29    |                                  ^^^^^^^
30
31 error: aborting due to 2 previous errors
32
33 Some errors have detailed explanations: E0379, E0790.
34 For more information about an error, try `rustc --explain E0379`.