mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
27 lines
454 B
Rust
27 lines
454 B
Rust
// 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(&()));
|
|
}
|
|
|
|
// EMIT_MIR inline_trait_method.test.Inline.after.mir
|
|
fn test(x: &dyn X) -> u32 {
|
|
// CHECK-LABEL: fn test(
|
|
// CHECK-NOT: inlined
|
|
x.y()
|
|
}
|
|
|
|
trait X {
|
|
fn y(&self) -> u32 {
|
|
1
|
|
}
|
|
}
|
|
|
|
impl X for () {
|
|
fn y(&self) -> u32 {
|
|
2
|
|
}
|
|
}
|