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

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

27 lines
454 B
Rust
Raw Normal View History

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