Skip to content

Update docs for inline_always + target_feature - #2391

Open
Jamesbarford wants to merge 1 commit into
rust-lang:masterfrom
Jamesbarford:feat/inline_always+target_feature
Open

Jamesbarford wants to merge 1 commit into
rust-lang:masterfrom
Jamesbarford:feat/inline_always+target_feature

Conversation

@Jamesbarford

Copy link
Copy Markdown

Documentation updates for the PR allowing inline_always + target_feature rust-lang/rust#162460

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Oct 19, 2026
Comment thread src/attributes/codegen.md Outdated
Comment on lines +317 to +319
r[attributes.codegen.target_feature.inline]
Functions marked with `target_feature` are not inlined into a context that
does not support the given features. The `#[inline(always)]` attribute may not
be used with a `target_feature` attribute.
does not support the given features, a guarantee provided by LLVM since version 23.

@RalfJung RalfJung Oct 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the attributes.codegen.target_feature.inline clause should be removed entirely. What does and does not get inlined is an implementation detail, not a guarantee. The only guarantee we provide is that we're not introducing UB into your code.

View changes since the review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've removed the entire passage now.

@Jamesbarford
Jamesbarford force-pushed the feat/inline_always+target_feature branch from b8e5028 to d21817a Compare October 19, 2026 11:43
@traviscross traviscross added S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository and removed S-waiting-on-review Status: The marked PR is awaiting review from a maintainer labels Oct 21, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 21, 2026
…rget-feature-rust-lang#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` rust-lang#2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
…#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2





This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 21, 2026
…rget-feature-rust-lang#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` rust-lang#2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
…#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2





This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
…#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2





This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 21, 2026
…rget-feature-rust-lang#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` rust-lang#2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
Rollup merge of #162460 - Jamesbarford:feat/inline-always+target-feature-#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants