summary refs log tree commit diff
path: root/src/test/mir-opt/inline-trait-method_2.rs
blob: 4ad4311113a3ad0ec39c6d8ca5c67c2aa46a1faa (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
29
30
31
32
33
34
35
36
// compile-flags: -Z span_free_formats -Z mir-opt-level=3

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(&()));
}

// END RUST SOURCE
// START rustc.test2.Inline.after.mir
// ...
// bb0: {
// ...
//     _0 = const <dyn X as X>::y(move _2) -> bb1;
// }
// ...
// END rustc.test2.Inline.after.mir