gcc/testsuite/rust/compile/torture/traits11.rs
raw| 1 | #[lang = "sized"] |
| 2 | pub trait Sized {} |
| 3 | |
| 4 | trait Foo { |
| 5 | type A; |
| 6 | |
| 7 | fn test(a: Self::A) -> Self::A { |
| 8 | a |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | struct Bar(i32); |
| 13 | impl Foo for Bar { |
| 14 | type A = i32; |
| 15 | } |
| 16 | |
| 17 | struct Baz(f32); |
| 18 | impl Foo for Baz { |
| 19 | type A = f32; |
| 20 | } |
| 21 | |
| 22 | fn main() { |
| 23 | let a; |
| 24 | a = Bar(123); |
| 25 | |
| 26 | let b; |
| 27 | b = Bar::test(a.0); |
| 28 | |
| 29 | let c; |
| 30 | c = Baz(123f32); |
| 31 | |
| 32 | let d; |
| 33 | d = Baz::test(c.0); |
| 34 | } |