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