Debian Codegraph @

gcc/testsuite/rust/compile/traits3.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 trait Foo {
5 type A;
6
7 fn baz(a: Self::A) -> Self::A;
8 }
9
10 struct Bar<T>(T);
11
12 impl<T> Foo for Bar<T> {
13 type A = i32;
14
15 fn baz(a: f32) -> f32 {
16 // { dg-error "expected" "" { target *-*-* } .-1 }
17 // { dg-error "method .baz. has an incompatible type for trait .Foo." "" { target *-*-* } .-2 }
18 a
19 }
20 }
21
22 fn main() {
23 let a;
24 a = Bar::<i32>::baz(123f32);
25 }