Skip to content

Allow forbidden target features to be hard errors#152821

Open
wesleywiser wants to merge 1 commit intorust-lang:mainfrom
wesleywiser:add_forbidden_ctarget_feature_hard_error_option
Open

Allow forbidden target features to be hard errors#152821
wesleywiser wants to merge 1 commit intorust-lang:mainfrom
wesleywiser:add_forbidden_ctarget_feature_hard_error_option

Conversation

@wesleywiser
Copy link
Member

@wesleywiser wesleywiser commented Feb 18, 2026

Sometimes when adding a new target features to the list of known target features, we want to completely forbid them from being used because they are ABI affecting and should be target modifiers instead. As such, we want to issue an error rather than a warning since there are no future compatibility concerns .

r? @workingjubilee since you're familiar with the motivating case in #136597

If I rebase that PR on top of this locally, then we get the following error messages when trying to activate the SLS target feature (note that they are errors not warnings and we've omitted the usual note about future compatibility):

error: target feature `harden-sls-ijmp` cannot be enabled with `-Ctarget-feature`: use `harden-sls` compiler flag instead

error: target feature `harden-sls-ret` cannot be enabled with `-Ctarget-feature`: use `harden-sls` compiler flag instead

error: aborting due to 2 previous errors

@rustbot rustbot added 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. labels Feb 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2026

workingjubilee is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@wesleywiser wesleywiser force-pushed the add_forbidden_ctarget_feature_hard_error_option branch from a882953 to 31a3497 Compare February 18, 2026 20:40
@workingjubilee
Copy link
Member

Thanks! This has indeed come up a few times (e.g. if nothing else, in features that we have never really had people rely on and thus a FCW makes no sense).

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments