Description
The --print target-features
and -C target-feature
options list/accept all target features LLVM knows, under the names LLVM gives them (see discussion in #49428). This is in contrast to #[target_feature]
and cfg(target_feature)
, which accept only explicitly whitelisted features, and in some cases change the LLVM names (e.g., bmi1
instead of bmi
). This is inconsistent, and also makes the command line interface less stable than it could be.
As @gnzlbg noted in #49428, this difference has existed for a while. However, in effect the command line options don't have a real stability guarantee: rustc
s not built with our LLVM fork don't currently recognize any target features, and the LLVM names can change under our feet (this was part of the rationale for having a whitelist in rustc). Note that -C
flags "without stability guarantee" are not without precedent, e.g., consider -C passes
(which also depends on LLVM internals).
So I believe we're within our rights to change this. Especially now that the whitelist is much more complete. And it has real advantages: consistency between command line and attributes/cfgs, more stability for the command line switch, and making it work on rustc
s with system LLVMs, thanks to @cuviper's work in #49428.
cc @japaric are you aware of uses of this option that aren't covered by the current whitelists?