aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-21 08:33:52 +0100
committerMartin Fischer <martin@push-f.com>2021-11-21 08:36:10 +0100
commit34dc166a9bc003bad36c28aeb29b625195d20a74 (patch)
tree1a4b7fbcd673f8094b019263cbe954ef38abb97c /tests
parentbd6f84036426c43e08078cf11e4ee70b7714ba2f (diff)
better errors for assoc types in where clauses
Diffstat (limited to 'tests')
-rw-r--r--tests/doctests.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/doctests.md b/tests/doctests.md
index 3318dba..8fa8306 100644
--- a/tests/doctests.md
+++ b/tests/doctests.md
@@ -54,3 +54,41 @@ trait Trait {
fn b<A: std::fmt::Display>(&self, a: A) -> Self::A;
}
```
+
+## Where clause must not contain associated types in complex predicates
+
+Works:
+
+```rust
+#[dynamize::dynamize]
+trait TraitWithCallback {
+ type A: Into<String>;
+
+ fn a<G>(&self, a: G) where G: Fn(Self::A);
+}
+```
+
+Fails:
+
+```rust compile_fail
+#[dynamize::dynamize]
+trait TraitWithCallback {
+ type A: Into<String>;
+
+ fn a<G>(&self, a: G) where G: Into<Self::A>;
+}
+```
+
+Fails:
+
+```rust compile_fail
+struct MyType<A>(A);
+trait SomeTrait {}
+
+#[dynamize::dynamize]
+trait TraitWithCallback {
+ type A: Into<String>;
+
+ fn a<G>(&self, a: G) where MyType<Self::A>: SomeTrait;
+}
+```