summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/inline/inline_trait_method_2.rs
blob: 378e71a25673f14cc82f4a438ede58a8591522ed (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
// 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(&()));
}