summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/in-trait/coherence-constrained.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/in-trait/coherence-constrained.rs')
-rw-r--r--tests/ui/async-await/in-trait/coherence-constrained.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/async-await/in-trait/coherence-constrained.rs b/tests/ui/async-await/in-trait/coherence-constrained.rs
new file mode 100644
index 000000000..8e62b3e0e
--- /dev/null
+++ b/tests/ui/async-await/in-trait/coherence-constrained.rs
@@ -0,0 +1,26 @@
+// edition: 2021
+
+trait Foo {
+ type T;
+
+ async fn foo(&self) -> Self::T;
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+impl Foo for Bar {
+ //~^ ERROR conflicting implementations of trait `Foo` for type `Bar`
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+fn main() {}