blob: 2b58cd4180bd337dbe1587faa416e5a971f7601b (
plain)
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
|
error[E0369]: cannot add `T` to `T`
--> $DIR/missing_trait_impl.rs:5:15
|
LL | let z = x + y;
| - ^ - T
| |
| T
|
help: consider restricting type parameter `T`
|
LL | fn foo<T: std::ops::Add>(x: T, y: T) {
| +++++++++++++++
error[E0368]: binary assignment operation `+=` cannot be applied to type `T`
--> $DIR/missing_trait_impl.rs:9:5
|
LL | x += x;
| -^^^^^
| |
| cannot use `+=` on type `T`
|
help: consider restricting type parameter `T`
|
LL | fn bar<T: std::ops::AddAssign>(x: T) {
| +++++++++++++++++++++
error[E0600]: cannot apply unary operator `-` to type `T`
--> $DIR/missing_trait_impl.rs:13:13
|
LL | let y = -x;
| ^^ cannot apply unary operator `-`
|
help: consider restricting type parameter `T`
|
LL | fn baz<T: std::ops::Neg>(x: T) {
| +++++++++++++++
error[E0600]: cannot apply unary operator `!` to type `T`
--> $DIR/missing_trait_impl.rs:14:13
|
LL | let y = !x;
| ^^ cannot apply unary operator `!`
|
help: consider restricting type parameter `T`
|
LL | fn baz<T: std::ops::Not>(x: T) {
| +++++++++++++++
error[E0614]: type `T` cannot be dereferenced
--> $DIR/missing_trait_impl.rs:15:13
|
LL | let y = *x;
| ^^
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0368, E0369, E0600, E0614.
For more information about an error, try `rustc --explain E0368`.
|