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 // Negative impl variant.
12 trait Object: Marker1 {}
14 // A supertrait marker is illegal...
15 impl !Marker1 for dyn Object + Marker2 {} //~ ERROR E0371
17 // ...and also a direct component.
18 impl !Marker2 for dyn Object + Marker2 {} //~ ERROR E0371
21 // A non-principal trait-object type is orphan even in its crate.
22 impl !Send for dyn Marker2 {} //~ ERROR E0117
24 // Implementing a marker for a local trait object is forbidden by a special
26 impl !Marker2 for dyn Object {} //~ ERROR E0321
27 impl !Send for dyn Object {} //~ ERROR E0321
28 impl !Send for dyn Object + Marker2 {} //~ ERROR E0321
30 // Blanket impl that applies to dyn Object is equally problematic.
32 impl<T: ?Sized> !Marker3 for T {} //~ ERROR E0321
35 impl<T> !Marker4 for T {} // okay