about summary refs log tree commit diff
path: root/src/test/mir-opt/inline-trait-method.rs
blob: 0f79f43ee2df07e8cc07457b4277270133d1e675 (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
// compile-flags: -Z span_free_formats

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

fn test(x: &dyn X) -> u32 {
    x.y()
}

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

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

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