Skip to content

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

Open
Jamesbarford wants to merge 4 commits into
rust-lang:mainfrom
Jamesbarford:feat/inline-always+target-feature-#2
Open

Feat - #[inline(always)] + #[target_feature(enable = "....")] #2#162460
Jamesbarford wants to merge 4 commits into
rust-lang:mainfrom
Jamesbarford:feat/inline-always+target-feature-#2

Conversation

@Jamesbarford

@Jamesbarford Jamesbarford commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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

This should now be sound thanks to

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

r? @RalfJung

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 8, 2026
@rustbot

rustbot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 8, 2026
@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

I am not available for reviews at the moment, sorry.
r? @nikic

@rustbot rustbot assigned nikic and unassigned RalfJung Sep 8, 2026
@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

Given LLVM is the validator it seems defensible to remove any Rust-side validation. Thus I removed the code for checking mismatching target features.

Which code are you referring to here?

Comment thread compiler/rustc_feature/src/unstable.rs Outdated
@Jamesbarford

Copy link
Copy Markdown
Contributor Author

Given LLVM is the validator it seems defensible to remove any Rust-side validation. Thus I removed the code for checking mismatching target features.

Which code are you referring to here?

I was referring to previous attempts at this such as; #155426 Where I made Rust-side error messages.

@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

@Jamesbarford
Jamesbarford force-pushed the feat/inline-always+target-feature-#2 branch from dd6d37d to bedba2e Compare September 8, 2026 10:20
@Jamesbarford

Copy link
Copy Markdown
Contributor Author

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

Yes 👍, I've made those removals another commit along with removing the tests bedba2e

Comment thread tests/ui/target-feature/inline-always-runtime.rs Outdated
@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

Yes 👍, I've made those removals another commit along with removing the tests bedba2e

I was asking about the original PR description. You now have changed the PR in response to my other comment, right?

That's fine but very confusing the way you are talking about it.


I see no reason to have this as an unstable feature. This was only ever working around LLVM bugs anyway (or, LLVM choices we weren't happy with, depending on how you want to put it). Now that LLVM is fixed we can rip off the bandaid. Let's nominate for t-lang then since this allows more code to compile -- are you happy with allowing inline(always) + target_feature, provided that we are reasonably sure that this is sound to do now? Or would you like to see some period of unstable experimentation first?

@rustbot label +I-lang-nominated
Cc @rust-lang/opsem

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Sep 8, 2026
@RalfJung RalfJung added the needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. label Sep 8, 2026
@saethlin

saethlin commented Sep 9, 2026

Copy link
Copy Markdown
Member

I never got around to investigating this, but I did confirm that codegen changes somewhere if you remove the call site attributes. So yes it's goofy but I think someone needs to understand what our call site attributes are doing before we make the change.

@Jamesbarford

Copy link
Copy Markdown
Contributor Author

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

Yes 👍, I've made those removals another commit along with removing the tests bedba2e

I was asking about the original PR description. You now have changed the PR in response to my other comment, right?

That's fine but very confusing the way you are talking about it.

I see no reason to have this as an unstable feature. This was only ever working around LLVM bugs anyway (or, LLVM choices we weren't happy with, depending on how you want to put it). Now that LLVM is fixed we can rip off the bandaid. Let's nominate for t-lang then since this allows more code to compile -- are you happy with allowing inline(always) + target_feature, provided that we are reasonably sure that this is sound to do now? Or would you like to see some period of unstable experimentation first?

@rustbot label +I-lang-nominated Cc @rust-lang/opsem

I originally changed it to remove the tracking issue. However I can see it's somewhat nebulous as to what I'm referring to so I have changed it again so I'm only mentioning this PR.

@RalfJung RalfJung Sep 9, 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.

Removed features never get removed from this file. Please undo the change here.

View changes since the review

@RalfJung RalfJung Sep 9, 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.

Removed lints never get removed from this file. Please undo the change here. You may want to update the justification string, but you have to keep the register_removed.

View changes since the review

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-lang-nominated Nominated for discussion during a lang team meeting. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants