2023-06-08 07:18:34 +00:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2024-04-15 01:22:35 +00:00
|
|
|
//@ compile-flags: -Z span_free_formats -Z mir-opt-level=4 -C debuginfo=full
|
2018-11-07 03:31:09 +00:00
|
|
|
|
2020-07-27 19:22:43 +00:00
|
|
|
// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
|
2019-01-24 19:05:19 +00:00
|
|
|
fn test2(x: &dyn X) -> bool {
|
2023-10-21 03:41:43 +00:00
|
|
|
// CHECK-LABEL: fn test2(
|
|
|
|
// CHECK: (inlined test)
|
|
|
|
// CHECK-NOT: (inlined <dyn X as X>::y)
|
2019-01-24 19:05:19 +00:00
|
|
|
test(x)
|
|
|
|
}
|
|
|
|
|
2018-11-07 03:31:09 +00: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(&()));
|
|
|
|
}
|