]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/impl-trait-return-missing-constraint.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / src / test / ui / associated-types / impl-trait-return-missing-constraint.rs
1 trait Foo {
2 type Item;
3 }
4
5 trait Bar: Foo {}
6
7 struct S;
8
9 impl Foo for S {
10 type Item = i32;
11 }
12 impl Bar for S {}
13
14 struct T;
15
16 impl Foo for T {
17 type Item = u32;
18 }
19 impl Bar for T {}
20
21 fn bar() -> impl Bar {
22 T
23 }
24
25 fn baz() -> impl Bar<Item = i32> {
26 //~^ ERROR type mismatch resolving `<impl Bar as Foo>::Item == i32`
27 bar()
28 }
29
30 fn main() {
31 let _ = baz();
32 }