Debian Codegraph @

gcc/testsuite/rust/compile/issue-2019-2.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 }
26
27 impl<'a> Add<&'a u32> for u32 {
28 type Output = <u32 as Add<u32>>::Output;
29
30 fn add(self, other: &'a u32) -> <u32 as Add<u32>>::Output {
31 Add::add(self, *other)
32 }
33 }