Skip to content

Commit

Permalink
Rollup merge of rust-lang#117319 - RalfJung:target-feature-inline-com…
Browse files Browse the repository at this point in the history
…ment, r=tmiasko

explain why we don't inline when target features differ

Follow-up to rust-lang#117141

r? `@tmiasko`
  • Loading branch information
workingjubilee authored Oct 28, 2023
2 parents c415a94 + f7985af commit ba1069e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_mir_transform/src/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ impl<'tcx> Inliner<'tcx> {
}

if callee_attrs.target_features != self.codegen_fn_attrs.target_features {
// In general it is not correct to inline a callee with target features that are a
// subset of the caller. This is because the callee might contain calls, and the ABI of
// those calls depends on the target features of the surrounding function. By moving a
// `Call` terminator from one MIR body to another with more target features, we might
// change the ABI of that call!
return Err("incompatible target features");
}

Expand Down

0 comments on commit ba1069e

Please sign in to comment.