diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/doctests.md | 38 |
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; +} +``` |