diff options
Diffstat (limited to 'tests/ui/impl-trait/in-assoc-type.rs')
-rw-r--r-- | tests/ui/impl-trait/in-assoc-type.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-assoc-type.rs b/tests/ui/impl-trait/in-assoc-type.rs new file mode 100644 index 00000000000..36c54bdd6de --- /dev/null +++ b/tests/ui/impl-trait/in-assoc-type.rs @@ -0,0 +1,21 @@ +#![feature(impl_trait_in_assoc_type)] + +trait Foo<T> { + type Bar; + fn foo(&self) -> <Self as Foo<()>>::Bar + where + Self: Foo<()>; +} + +impl Foo<()> for () { + type Bar = impl std::fmt::Debug; + fn foo(&self) -> Self::Bar {} +} + +impl Foo<i32> for () { + type Bar = u32; + fn foo(&self) -> <Self as Foo<()>>::Bar {} + //~^ ERROR: mismatched types +} + +fn main() {} |