rust/tests/mir-opt/inline/inline_trait_method_2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
556 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ compile-flags: -Z span_free_formats -Z mir-opt-level=4 -C debuginfo=full
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 {
2023-10-20 22:41:43 -05:00
// CHECK-LABEL: fn test2(
// CHECK: (inlined test)
// CHECK-NOT: (inlined <dyn X as X>::y)
2019-01-24 13:05:19 -06:00
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(&()));
}