about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/coherence/auxiliary/error_lib.rs5
-rw-r--r--src/test/ui/coherence/coherence-overlap-negative-trait.rs14
2 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/coherence/auxiliary/error_lib.rs b/src/test/ui/coherence/auxiliary/error_lib.rs
new file mode 100644
index 00000000000..43806cb995c
--- /dev/null
+++ b/src/test/ui/coherence/auxiliary/error_lib.rs
@@ -0,0 +1,5 @@
+#![crate_type = "lib"]
+#![feature(negative_impls)]
+
+pub trait Error {}
+impl !Error for &str {}
diff --git a/src/test/ui/coherence/coherence-overlap-negative-trait.rs b/src/test/ui/coherence/coherence-overlap-negative-trait.rs
new file mode 100644
index 00000000000..357c4e87c91
--- /dev/null
+++ b/src/test/ui/coherence/coherence-overlap-negative-trait.rs
@@ -0,0 +1,14 @@
+// check-pass
+// aux-build:error_lib.rs
+//
+// Check that if we promise to not impl what would overlap it doesn't actually overlap
+
+extern crate error_lib as lib;
+use lib::Error;
+
+trait From<T> {}
+
+impl From<&str> for Box<dyn Error> {}
+impl<E> From<E> for Box<dyn Error> where E: Error {}
+
+fn main() {}