aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-2019-2.rs
blob: 9f7c0c01bbe59a363876f4d9e79711803e291588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#[lang = "sized"]
pub trait Sized {}

#[lang = "add"]
pub trait Add<RHS = Self> {
    type Output;

    fn add(self, rhs: RHS) -> Self::Output;
}

impl Add for u32 {
    type Output = u32;

    fn add(self, other: u32) -> u32 {
        self + other
    }
}

impl<'a> Add<u32> for &'a u32 {
    type Output = <u32 as Add<u32>>::Output;

    fn add(self, other: u32) -> <u32 as Add<u32>>::Output {
        Add::add(*self, other)
    }
}

impl<'a> Add<&'a u32> for u32 {
    type Output = <u32 as Add<u32>>::Output;

    fn add(self, other: &'a u32) -> <u32 as Add<u32>>::Output {
        Add::add(self, *other)
    }
}