Rollup merge of #117319 - RalfJung:target-feature-inline-comment, r=tmiasko

explain why we don't inline when target features differ

Follow-up to https://github.com/rust-lang/rust/pull/117141

r? ``@tmiasko``
This commit is contained in:
Jubilee 2023-10-28 17:08:05 -07:00 committed by GitHub
commit f907d0e51c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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");
}