Auto merge of #55046 - wesleywiser:no_virtual_call_inlining, r=varkor
[mir-inlining] Don't inline virtual calls
This commit is contained in:
commit
0c665e20db
2 changed files with 47 additions and 7 deletions
31
src/test/mir-opt/inline-trait-method.rs
Normal file
31
src/test/mir-opt/inline-trait-method.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// compile-flags: -Z span_free_formats
|
||||
|
||||
fn main() {
|
||||
println!("{}", test(&()));
|
||||
}
|
||||
|
||||
fn test(x: &dyn X) -> u32 {
|
||||
x.y()
|
||||
}
|
||||
|
||||
trait X {
|
||||
fn y(&self) -> u32 {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
impl X for () {
|
||||
fn y(&self) -> u32 {
|
||||
2
|
||||
}
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.test.Inline.after.mir
|
||||
// ...
|
||||
// bb0: {
|
||||
// ...
|
||||
// _0 = const X::y(move _2) -> bb1;
|
||||
// }
|
||||
// ...
|
||||
// END rustc.test.Inline.after.mir
|
||||
Loading…
Add table
Add a link
Reference in a new issue