1
Fork 0

target_features: control separately whether enabling and disabling a target feature is allowed

This commit is contained in:
Ralf Jung 2024-11-24 12:22:01 +01:00
parent a1740a9c35
commit eb2e928250
5 changed files with 64 additions and 31 deletions

View file

@ -483,9 +483,9 @@ fn target_features_cfg(
.rust_target_features()
.iter()
.filter(|(_, gate, _)| gate.in_cfg())
.filter_map(|&(feature, gate, _)| {
.filter_map(|(feature, gate, _)| {
if sess.is_nightly_build() || allow_unstable || gate.requires_nightly().is_none() {
Some(feature)
Some(*feature)
} else {
None
}