Skip to content

Commit

Permalink
Unrolled build for rust-lang#117319
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#117319 - RalfJung:target-feature-inline-comment, r=tmiasko

explain why we don't inline when target features differ

Follow-up to rust-lang#117141

r? ``@tmiasko``
  • Loading branch information
rust-timer authored Oct 29, 2023
2 parents 2cad938 + f7985af commit 5dfaa0f
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 5dfaa0f

Please sign in to comment.