Skip to content

Commit ce602ac

Browse files
committed
clarify target_feature + forced inlining
1 parent 3169a44 commit ce602ac

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Diff for: compiler/rustc_codegen_ssa/src/codegen_attrs.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -627,17 +627,19 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
627627
// enabled. For that reason we also forbid `#[inline(always)]` as it can't be
628628
// respected.
629629
//
630-
// `#[rustc_force_inline]` doesn't need to be prohibited here, that
631-
// is implemented entirely in rustc can attempt to inline and error if it cannot.
630+
// `#[rustc_force_inline]` doesn't need to be prohibited here, only
631+
// `#[inline(always)]`, as forced inlining is implemented entirely within
632+
// rustc (and so the MIR inliner can do any necessary checks for compatible target
633+
// features).
634+
//
635+
// This sidesteps the LLVM blockers in enabling `target_features` +
636+
// `inline(always)` to be used together (see rust-lang/rust#116573 and
637+
// llvm/llvm-project#70563).
632638
if !codegen_fn_attrs.target_features.is_empty()
633639
&& matches!(codegen_fn_attrs.inline, InlineAttr::Always)
634640
{
635641
if let Some(span) = inline_span {
636-
tcx.dcx().span_err(
637-
span,
638-
"cannot use `#[inline(always)]` with \
639-
`#[target_feature]`",
640-
);
642+
tcx.dcx().span_err(span, "cannot use `#[inline(always)]` with `#[target_feature]`");
641643
}
642644
}
643645

0 commit comments

Comments
 (0)