1
- error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1`
1
+ error[E0371]: the object type `(dyn Object + Marker1 + Marker2 + 'static)` automatically implements the trait `Marker1`
2
2
--> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1
3
3
|
4
4
LL | impl Marker1 for dyn Object + Marker2 {}
5
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1`
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker1 + Marker2 + 'static)` automatically implements trait `Marker1`
6
6
7
- error[E0321]: traits with a default impl, like `Marker1`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)`
7
+ error[E0371]: the object type `(dyn Object + Marker1 + Marker2 + 'static)` automatically implements the trait `Marker1`
8
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1
9
+ |
10
+ LL | impl Marker1 for dyn Object + Marker2 {}
11
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker1 + Marker2 + 'static)` automatically implements trait `Marker1`
12
+ |
13
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
14
+
15
+ error[E0321]: traits with a default impl, like `Marker1`, cannot be implemented for trait object `(dyn Object + Marker1 + Marker2 + 'static)`
8
16
--> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1
9
17
|
10
18
LL | impl Marker1 for dyn Object + Marker2 {}
11
19
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
20
|
13
21
= note: a trait object implements `Marker1` if and only if `Marker1` is one of the trait object's trait bounds
14
22
15
- error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2`
16
- --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:18 :1
23
+ error[E0371]: the object type `(dyn Object + Marker1 + Marker2 + 'static)` automatically implements the trait `Marker2`
24
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:20 :1
17
25
|
18
26
LL | impl Marker2 for dyn Object + Marker2 {}
19
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2`
27
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker1 + Marker2 + 'static)` automatically implements trait `Marker2`
20
28
21
- error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)`
22
- --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:18 :1
29
+ error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + Marker1 + Marker2 + 'static)`
30
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:20 :1
23
31
|
24
32
LL | impl Marker2 for dyn Object + Marker2 {}
25
33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
34
|
27
35
= note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds
28
36
29
- error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + 'static)`
30
- --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26 :1
37
+ error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + Marker1 + 'static)`
38
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:28 :1
31
39
|
32
40
LL | impl Marker2 for dyn Object {}
33
41
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
34
42
|
35
43
= note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds
36
44
37
45
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
38
- --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22 :1
46
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:24 :1
39
47
|
40
48
LL | unsafe impl Send for dyn Marker2 {}
41
49
| ^^^^^^^^^^^^^^^^^^^^^-----------
@@ -45,27 +53,27 @@ LL | unsafe impl Send for dyn Marker2 {}
45
53
|
46
54
= note: define and implement a trait or new type instead
47
55
48
- error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)`
49
- --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27 :1
56
+ error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker1 + 'static)`
57
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:29 :1
50
58
|
51
59
LL | unsafe impl Send for dyn Object {}
52
60
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
53
61
54
- error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)`
55
- --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:28 :1
62
+ error[E0321]: cross-crate traits with a default impl, like `Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker1 + Marker2 + 'static)`
63
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:30 :1
56
64
|
57
65
LL | unsafe impl Send for dyn Object + Marker2 {}
58
66
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
59
67
60
68
error[E0321]: traits with a default impl, like `Marker3`, cannot be implemented for generic type `T`
61
- --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:32 :1
69
+ --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:34 :1
62
70
|
63
71
LL | impl<T: ?Sized> Marker3 for T {}
64
72
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65
73
|
66
74
= note: a trait object implements `Marker3` if and only if `Marker3` is one of the trait object's trait bounds
67
75
68
- error: aborting due to 9 previous errors
76
+ error: aborting due to 10 previous errors
69
77
70
78
Some errors have detailed explanations: E0117, E0321, E0371.
71
79
For more information about an error, try `rustc --explain E0117`.
0 commit comments