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 29, 2023
2 parents 2dd37d4 + f7985af commit f907d0e
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 f907d0e

Please sign in to comment.