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