aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-2019-1.rs
blob: e91e347b2ea6cf33df581dbe8d64a97a0a23a8e1 (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
#[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)
    }
}