summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/inline/inline_trait_method.rs
blob: 6aa957eb5349f7c3a0b877b0a030afceb369658c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ignore-wasm32 compiled with panic=abort by default
// compile-flags: -Z span_free_formats

fn main() {
    println!("{}", test(&()));
}

// EMIT_MIR inline_trait_method.test.Inline.after.mir
fn test(x: &dyn X) -> u32 {
    x.y()
}

trait X {
    fn y(&self) -> u32 {
        1
    }
}

impl X for () {
    fn y(&self) -> u32 {
        2
    }
}