@@ -27,11 +27,13 @@ LL + #[derive(ConstParamTy)]
27
27
LL | struct Foo(u8);
28
28
|
29
29
30
- error[E0284 ]: type annotations needed: cannot normalize `foo<N>::{constant#0}`
31
- --> $DIR/unify-op-with-fn-call.rs:20:25
30
+ error[E0015 ]: cannot call non-const operator in constants
31
+ --> $DIR/unify-op-with-fn-call.rs:20:39
32
32
|
33
33
LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
34
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo<N>::{constant#0}`
34
+ | ^^^^^
35
+ |
36
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
35
37
36
38
error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
37
39
--> $DIR/unify-op-with-fn-call.rs:20:17
@@ -63,19 +65,29 @@ error[E0284]: type annotations needed: cannot normalize `foo2<N>::{constant#0}`
63
65
LL | fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) {
64
66
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo2<N>::{constant#0}`
65
67
66
- error[E0284 ]: type annotations needed: cannot normalize `foo<N >::{constant#0}`
67
- --> $DIR/unify-op-with-fn-call.rs:21:11
68
+ error[E0015 ]: cannot call non-const fn `<Foo as Add >::add` in constants
69
+ --> $DIR/unify-op-with-fn-call.rs:21:13
68
70
|
69
71
LL | bar::<{ std::ops::Add::add(N, N) }>();
70
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo<N>::{constant#0}`
72
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
73
+ |
74
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
75
+
76
+ error[E0015]: cannot call non-const fn `<usize as Add>::add` in constants
77
+ --> $DIR/unify-op-with-fn-call.rs:30:14
78
+ |
79
+ LL | bar2::<{ std::ops::Add::add(N, N) }>();
80
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
81
+ |
82
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
71
83
72
84
error[E0284]: type annotations needed: cannot normalize `foo2<N>::{constant#0}`
73
85
--> $DIR/unify-op-with-fn-call.rs:30:12
74
86
|
75
87
LL | bar2::<{ std::ops::Add::add(N, N) }>();
76
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo2<N>::{constant#0}`
77
89
78
- error: aborting due to 9 previous errors
90
+ error: aborting due to 10 previous errors
79
91
80
- Some errors have detailed explanations: E0284, E0741.
81
- For more information about an error, try `rustc --explain E0284 `.
92
+ Some errors have detailed explanations: E0015, E0284, E0741.
93
+ For more information about an error, try `rustc --explain E0015 `.
0 commit comments