ABI-required target features: warn when they are missing in base CPU (rather than silently enabling them)

This commit is contained in:
Ralf Jung
2025-01-27 18:30:17 +01:00
parent f753850659
commit 93ee180cfa
15 changed files with 80 additions and 127 deletions

View File

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