summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-types/impl-trait-return-missing-constraint.rs
blob: 1de1ddbe3a4d0f3813197cd9187dca471aeb4b16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
trait Foo {
    type Item;
}

trait Bar: Foo {}

struct S;

impl Foo for S {
    type Item = i32;
}
impl Bar for S {}

struct T;

impl Foo for T {
    type Item = u32;
}
impl Bar for T {}

fn bar() -> impl Bar {
    T
}

fn baz() -> impl Bar<Item = i32> {
    //~^ ERROR type mismatch resolving `<impl Bar as Foo>::Item == i32`
    bar()
}

fn main() {
    let _ = baz();
}