2023-10-22 09:27:43 -07:00
|
|
|
// Verify that we do not inline the default impl in a trait object.
|
2023-06-08 09:18:34 +02:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2018-10-11 21:28:20 -04:00
|
|
|
// compile-flags: -Z span_free_formats
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
println!("{}", test(&()));
|
|
|
|
}
|
|
|
|
|
2020-07-27 21:22:43 +02:00
|
|
|
// EMIT_MIR inline_trait_method.test.Inline.after.mir
|
2018-10-11 21:28:20 -04:00
|
|
|
fn test(x: &dyn X) -> u32 {
|
2023-10-20 21:32:56 -07:00
|
|
|
// CHECK-LABEL: fn test(
|
2023-10-22 09:27:43 -07:00
|
|
|
// CHECK-NOT: inlined
|
2018-10-11 21:28:20 -04:00
|
|
|
x.y()
|
|
|
|
}
|
|
|
|
|
|
|
|
trait X {
|
|
|
|
fn y(&self) -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl X for () {
|
|
|
|
fn y(&self) -> u32 {
|
|
|
|
2
|
|
|
|
}
|
|
|
|
}
|