File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed
src/test/ui/type-alias-impl-trait Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
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() {}
Original file line number Diff line number Diff line change
1
+ error[E0271]: type mismatch resolving `<() as Bar>::Foo == ()`
2
+ --> $DIR/issue-63355.rs:34:20
3
+ |
4
+ LL | pub type FooImpl = impl Foo;
5
+ | -------- the found opaque type
6
+ LL | pub type BarImpl = impl Bar<Foo = FooImpl>;
7
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type
8
+ |
9
+ = note: expected unit type `()`
10
+ found opaque type `impl Foo`
11
+
12
+ error: aborting due to previous error
13
+
14
+ For more information about this error, try `rustc --explain E0271`.
You can’t perform that action at this time.
0 commit comments