summaryrefslogtreecommitdiffstats
path: root/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs')
-rw-r--r--tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs
index faac6d983..db2e2b450 100644
--- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs
+++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.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 E0321
// ...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 E0321
// A non-principal trait-object type is orphan even in its crate.
unsafe 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
unsafe impl Send for dyn Object {} //~ ERROR E0321
unsafe 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() {}