1
+ error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
2
+ --> $DIR/call-const-trait-method-pass.rs:7:12
3
+ |
4
+ LL | impl const std::ops::Add for Int {
5
+ | ^^^^^^^^^^^^^
6
+ |
7
+ = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
8
+ = note: adding a non-const method body in the future would be a breaking change
9
+
10
+ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
11
+ --> $DIR/call-const-trait-method-pass.rs:15:12
12
+ |
13
+ LL | impl const PartialEq for Int {
14
+ | ^^^^^^^^^
15
+ |
16
+ = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
17
+ = note: adding a non-const method body in the future would be a breaking change
18
+
19
+ error[E0049]: method `plus` has 1 const parameter but its trait declaration has 0 const parameters
20
+ --> $DIR/call-const-trait-method-pass.rs:24:1
21
+ |
22
+ LL | #[const_trait]
23
+ | ^^^^^^^^^^^^^^ found 1 const parameter
24
+ LL | pub trait Plus {
25
+ LL | fn plus(self, rhs: Self) -> Self;
26
+ | - expected 0 const parameters
27
+
1
28
error[E0015]: cannot call non-const operator in constants
2
29
--> $DIR/call-const-trait-method-pass.rs:39:22
3
30
|
4
31
LL | const ADD_INT: Int = Int(1i32) + Int(2i32);
5
32
| ^^^^^^^^^^^^^^^^^^^^^
6
33
|
7
- note: impl defined here, but it is not `const`
8
- --> $DIR/call-const-trait-method-pass.rs:7:1
9
- |
10
- LL | impl const std::ops::Add for Int {
11
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
34
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
13
35
help: add `#![feature(effects)]` to the crate attributes to enable
14
36
|
15
37
LL + #![feature(effects)]
16
38
|
17
39
40
+ error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
41
+ --> $DIR/call-const-trait-method-pass.rs:11:20
42
+ |
43
+ LL | Int(self.0.plus(rhs.0))
44
+ | ^^^^^^^^^^^
45
+ |
46
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
47
+ help: add `#![feature(effects)]` to the crate attributes to enable
48
+ |
49
+ LL + #![feature(effects)]
50
+ |
51
+
52
+ error[E0015]: cannot call non-const fn `<Int as PartialEq>::eq` in constant functions
53
+ --> $DIR/call-const-trait-method-pass.rs:20:15
54
+ |
55
+ LL | !self.eq(other)
56
+ | ^^^^^^^^^
57
+ |
58
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
59
+ help: add `#![feature(effects)]` to the crate attributes to enable
60
+ |
61
+ LL + #![feature(effects)]
62
+ |
63
+
18
64
error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
19
65
--> $DIR/call-const-trait-method-pass.rs:36:7
20
66
|
@@ -27,6 +73,7 @@ help: add `#![feature(effects)]` to the crate attributes to enable
27
73
LL + #![feature(effects)]
28
74
|
29
75
30
- error: aborting due to 2 previous errors
76
+ error: aborting due to 7 previous errors
31
77
32
- For more information about this error, try `rustc --explain E0015`.
78
+ Some errors have detailed explanations: E0015, E0049.
79
+ For more information about an error, try `rustc --explain E0015`.
0 commit comments