aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/traits3.rs
blob: fd3fa457cc8789b4d9ffc0539bbb428174517a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
trait Foo {
    type A;

    fn baz(a: Self::A) -> Self::A;
}

struct Bar<T>(T);

impl<T> Foo for Bar<T> {
    type A = i32;

    fn baz(a: f32) -> f32 {
        // { dg-error "method .baz. has an incompatible type for trait .Foo." "" { target *-*-* } .-1 }
        a
        // { dg-error "expected .i32. got .f32." "" { target *-*-* } .-1 }
    }
}

fn main() {
    let a;
    a = Bar::<i32>::baz(123f32);
}