summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/inline/inline_trait_method_2.rs
blob: 07a60190801888931afbc7c09ff9274c61ff6bca (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
// ignore-wasm32 compiled with panic=abort by default
// compile-flags: -Z span_free_formats -Z mir-opt-level=4

// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
fn test2(x: &dyn X) -> bool {
    test(x)
}

#[inline]
fn test(x: &dyn X) -> bool {
    x.y()
}

trait X {
    fn y(&self) -> bool {
        false
    }
}

impl X for () {
    fn y(&self) -> bool {
        true
    }
}

fn main() {
    println!("Should be true: {}", test2(&()));
}