summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/type-alias-impl-trait/coherence_cross_crate.rs')
-rw-r--r--tests/ui/type-alias-impl-trait/coherence_cross_crate.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs b/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
new file mode 100644
index 000000000..a63e0a1ee
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
@@ -0,0 +1,24 @@
+// aux-build: coherence_cross_crate_trait_decl.rs
+// This test ensures that adding an `impl SomeTrait for i32` within
+// `coherence_cross_crate_trait_decl` is not a breaking change, by
+// making sure that even without such an impl this test fails to compile.
+
+#![feature(type_alias_impl_trait)]
+
+extern crate coherence_cross_crate_trait_decl;
+
+use coherence_cross_crate_trait_decl::SomeTrait;
+
+trait OtherTrait {}
+
+type Alias = impl SomeTrait;
+
+fn constrain() -> Alias {
+ ()
+}
+
+impl OtherTrait for Alias {}
+impl OtherTrait for i32 {}
+//~^ ERROR: conflicting implementations of trait `OtherTrait` for type `Alias`
+
+fn main() {}