File: unify-op-with-fn-call.stderr

package info (click to toggle)
rustc-web 1.78.0%2Bdfsg1-2~deb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,245,360 kB
  • sloc: xml: 147,985; javascript: 18,022; sh: 11,083; python: 10,265; ansic: 6,172; cpp: 5,023; asm: 4,390; makefile: 4,269
file content (80 lines) | stat: -rw-r--r-- 2,789 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
  --> $DIR/unify-op-with-fn-call.rs:18:29
   |
LL | struct Evaluatable<const N: Foo>;
   |                             ^^^
   |
help: add `#[derive(ConstParamTy)]` to the struct
   |
LL + #[derive(ConstParamTy)]
LL | struct Foo(u8);
   |

error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
  --> $DIR/unify-op-with-fn-call.rs:20:17
   |
LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
   |                 ^^^
   |
help: add `#[derive(ConstParamTy)]` to the struct
   |
LL + #[derive(ConstParamTy)]
LL | struct Foo(u8);
   |

error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
  --> $DIR/unify-op-with-fn-call.rs:24:17
   |
LL | fn bar<const N: Foo>() {}
   |                 ^^^
   |
help: add `#[derive(ConstParamTy)]` to the struct
   |
LL + #[derive(ConstParamTy)]
LL | struct Foo(u8);
   |

error: unconstrained generic constant
  --> $DIR/unify-op-with-fn-call.rs:30:12
   |
LL |     bar2::<{ std::ops::Add::add(N, N) }>();
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: try adding a `where` bound using this expression: `where [(); { std::ops::Add::add(N, N) }]:`

error[E0015]: cannot call non-const operator in constants
  --> $DIR/unify-op-with-fn-call.rs:20:39
   |
LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
   |                                       ^^^^^
   |
note: impl defined here, but it is not `const`
  --> $DIR/unify-op-with-fn-call.rs:10:1
   |
LL | impl const std::ops::Add for Foo {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
   = help: add `#![feature(effects)]` to the crate attributes to enable

error[E0015]: cannot call non-const fn `<Foo as Add>::add` in constants
  --> $DIR/unify-op-with-fn-call.rs:21:13
   |
LL |     bar::<{ std::ops::Add::add(N, N) }>();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
   = help: add `#![feature(effects)]` to the crate attributes to enable

error[E0015]: cannot call non-const fn `<usize as Add>::add` in constants
  --> $DIR/unify-op-with-fn-call.rs:30:14
   |
LL |     bar2::<{ std::ops::Add::add(N, N) }>();
   |              ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
   = help: add `#![feature(effects)]` to the crate attributes to enable

error: aborting due to 7 previous errors

Some errors have detailed explanations: E0015, E0741.
For more information about an error, try `rustc --explain E0015`.