aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/traits3.rs
blob: 119132f80e88afd26aacf65f5803332ad7882f84 (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
#[lang = "sized"]
pub trait Sized {}

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 "expected" "" { target *-*-* } .-1 }
        // { dg-error "method .baz. has an incompatible type for trait .Foo." "" { target *-*-* } .-2 }
        a
    }
}

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