]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/issue-63355.rs
Rollup merge of #93692 - mfrw:mfrw/document-keyword-in, r=dtolnay
[rust.git] / src / test / ui / type-alias-impl-trait / issue-63355.rs
1 #![feature(type_alias_impl_trait)]
2 #![allow(incomplete_features)]
3
4 pub trait Foo {}
5
6 pub trait Bar {
7     type Foo: Foo;
8
9     fn foo() -> Self::Foo;
10 }
11
12 pub trait Baz {
13     type Foo: Foo;
14     type Bar: Bar<Foo = Self::Foo>;
15
16     fn foo() -> Self::Foo;
17     fn bar() -> Self::Bar;
18 }
19
20 impl Foo for () {}
21
22 impl Bar for () {
23     type Foo = FooImpl;
24
25     fn foo() -> Self::Foo {
26         ()
27     }
28 }
29
30 // FIXME(#86731): The below is illegal use of `type_alias_impl_trait`
31 // but the compiler doesn't report it, we should fix it.
32 pub type FooImpl = impl Foo;
33 pub type BarImpl = impl Bar<Foo = FooImpl>;
34 //~^ ERROR: type mismatch resolving `<() as Bar>::Foo == ()`
35
36 impl Baz for () {
37     type Foo = FooImpl;
38     type Bar = BarImpl;
39
40     fn foo() -> Self::Foo {
41         ()
42     }
43
44     fn bar() -> Self::Bar {
45         ()
46     }
47 }
48
49 fn main() {}