Skip to content

Commit f7985af

Browse files
committed
explain why we don't inline when target features differ
1 parent 615d0f2 commit f7985af

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_mir_transform/src/inline.rs

+5
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ impl<'tcx> Inliner<'tcx> {
439439
}
440440

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

0 commit comments

Comments
 (0)