1 #![feature(auto_traits)]
2 #![feature(negative_impls)]
4 // Test for issue #56934 - that it is impossible to redundantly
5 // implement an auto-trait for a trait object type that contains it.
7 // Positive impl variant.
12 trait Object: Marker1 {}
14 // A supertrait marker is illegal...
15 impl Marker1 for dyn Object + Marker2 { } //~ ERROR E0371
16 // ...and also a direct component.
17 impl Marker2 for dyn Object + Marker2 { } //~ ERROR E0371
19 // But implementing a marker if it is not present is OK.
20 impl Marker2 for dyn Object {} // OK
22 // A non-principal trait-object type is orphan even in its crate.
23 unsafe impl Send for dyn Marker2 {} //~ ERROR E0117
25 // And impl'ing a remote marker for a local trait object is forbidden
26 // by one of these special orphan-like rules.
27 unsafe impl Send for dyn Object {} //~ ERROR E0321
28 unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321