aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/impl_rpit3.rs
blob: dd68eb29ef964470d62dcc33d86e3b628eb03c00 (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"]
trait Sized {}

trait Foo {
    fn id(&self) -> i32;
}

struct Thing(i32);

impl Foo for Thing {
    fn id(&self) -> i32 {
        self.0
    }
}

fn make_thing() -> impl Foo {
    Thing(99)
}

fn main() -> i32 {
    let v = make_thing();
    let r = &v;
    let val = r.id();
    val - 99
}