2021-03-04 07:21:13 -06:00
|
|
|
// compile-flags: -Z span_free_formats -Z mir-opt-level=4
|
2018-11-06 21:31:09 -06:00
|
|
|
|
2020-07-27 14:22:43 -05:00
|
|
|
// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
|
2019-01-24 13:05:19 -06:00
|
|
|
fn test2(x: &dyn X) -> bool {
|
|
|
|
test(x)
|
|
|
|
}
|
|
|
|
|
2018-11-06 21:31:09 -06:00
|
|
|
#[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(&()));
|
|
|
|
}
|