summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/link/trait_import_0.rs
blob: ac8c5811d22b40068fa9b462cfaa8b26f11edaf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
extern crate trait_import_1;
use trait_import_1::Add;

struct Foo(i32);

impl Add for Foo {
    type Output = Foo;

    fn add(self, other: Foo) -> Foo {
        Foo(self.0 + other.0)
    }
}

fn main() -> i32 {
    let a;
    a = Foo(1) + Foo(2);

    0
}