]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/inline/inline-trait-method_2.rs
Render const pointers in MIR more compactly
[rust.git] / src / test / mir-opt / inline / inline-trait-method_2.rs
1 // compile-flags: -Z span_free_formats -Z mir-opt-level=3
2
3 fn test2(x: &dyn X) -> bool {
4     test(x)
5 }
6
7 #[inline]
8 fn test(x: &dyn X) -> bool {
9     x.y()
10 }
11
12 trait X {
13     fn y(&self) -> bool {
14         false
15     }
16 }
17
18 impl X for () {
19     fn y(&self) -> bool {
20         true
21     }
22 }
23
24 fn main() {
25     println!("Should be true: {}", test2(&()));
26 }
27
28 // END RUST SOURCE
29 // START rustc.test2.Inline.after.mir
30 // ...
31 // bb0: {
32 // ...
33 //     _0 = const <dyn X as X>::y(move _2) -> bb1;
34 // }
35 // ...
36 // END rustc.test2.Inline.after.mir