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`
22 --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1
33 |
44LL | 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`
66
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)`
816 --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1
917 |
1018LL | impl Marker1 for dyn Object + Marker2 {}
1119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1220 |
1321 = note: a trait object implements `Marker1` if and only if `Marker1` is one of the trait object's trait bounds
1422
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
1725 |
1826LL | 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`
2028
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
2331 |
2432LL | impl Marker2 for dyn Object + Marker2 {}
2533 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2634 |
2735 = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds
2836
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
3139 |
3240LL | impl Marker2 for dyn Object {}
3341 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3442 |
3543 = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds
3644
3745error[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
3947 |
4048LL | unsafe impl Send for dyn Marker2 {}
4149 | ^^^^^^^^^^^^^^^^^^^^^-----------
@@ -45,27 +53,27 @@ LL | unsafe impl Send for dyn Marker2 {}
4553 |
4654 = note: define and implement a trait or new type instead
4755
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
5058 |
5159LL | unsafe impl Send for dyn Object {}
5260 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
5361
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
5664 |
5765LL | unsafe impl Send for dyn Object + Marker2 {}
5866 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
5967
6068error[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
6270 |
6371LL | impl<T: ?Sized> Marker3 for T {}
6472 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6573 |
6674 = note: a trait object implements `Marker3` if and only if `Marker3` is one of the trait object's trait bounds
6775
68- error: aborting due to 9 previous errors
76+ error: aborting due to 10 previous errors
6977
7078Some errors have detailed explanations: E0117, E0321, E0371.
7179For more information about an error, try `rustc --explain E0117`.
0 commit comments