Files
rust/compiler/rustc_codegen_ssa
Jonathan Brouwer 7ab3168371 Rollup merge of #152821 - wesleywiser:add_forbidden_ctarget_feature_hard_error_option, r=dingxiangfei2009
Allow forbidden target features to be hard errors

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 rust-lang/rust#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
```
2026-05-22 16:21:26 +02:00
..