gcc/testsuite/rust/compile/issue-2019-1.rs
raw| 1 | #[lang = "sized"] |
| 2 | pub trait Sized {} |
| 3 | |
| 4 | #[lang = "add"] |
| 5 | pub trait Add<RHS = Self> { |
| 6 | type Output; |
| 7 | |
| 8 | fn add(self, rhs: RHS) -> Self::Output; |
| 9 | } |
| 10 | |
| 11 | impl Add for u32 { |
| 12 | type Output = u32; |
| 13 | |
| 14 | fn add(self, other: u32) -> u32 { |
| 15 | self + other |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | impl<'a> Add<u32> for &'a u32 { |
| 20 | type Output = <u32 as Add<u32>>::Output; |
| 21 | |
| 22 | fn add(self, other: u32) -> <u32 as Add<u32>>::Output { |
| 23 | Add::add(*self, other) |
| 24 | } |
| 25 | } |