summaryrefslogtreecommitdiffstats
path: root/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs')
-rw-r--r--tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs
index 50d9a480a..98f1558b7 100644
--- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs
+++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs
@@ -12,19 +12,26 @@ auto trait Marker2 {}
trait Object: Marker1 {}
// A supertrait marker is illegal...
-impl !Marker1 for dyn Object + Marker2 { } //~ ERROR E0371
+impl !Marker1 for dyn Object + Marker2 {} //~ ERROR E0371
+ //~^ ERROR 0321
// ...and also a direct component.
-impl !Marker2 for dyn Object + Marker2 { } //~ ERROR E0371
-
-// But implementing a marker if it is not present is OK.
-impl !Marker2 for dyn Object {} // OK
+impl !Marker2 for dyn Object + Marker2 {} //~ ERROR E0371
+ //~^ ERROR 0321
// A non-principal trait-object type is orphan even in its crate.
impl !Send for dyn Marker2 {} //~ ERROR E0117
-// And impl'ing a remote marker for a local trait object is forbidden
-// by one of these special orphan-like rules.
+// Implementing a marker for a local trait object is forbidden by a special
+// orphan-like rule.
+impl !Marker2 for dyn Object {} //~ ERROR E0321
impl !Send for dyn Object {} //~ ERROR E0321
impl !Send for dyn Object + Marker2 {} //~ ERROR E0321
-fn main() { }
+// Blanket impl that applies to dyn Object is equally problematic.
+auto trait Marker3 {}
+impl<T: ?Sized> !Marker3 for T {} //~ ERROR E0321
+
+auto trait Marker4 {}
+impl<T> !Marker4 for T {} // okay
+
+fn main() {}