target_features: control separately whether enabling and disabling a target feature is allowed
This commit is contained in:
parent
a1740a9c35
commit
eb2e928250
5 changed files with 64 additions and 31 deletions
|
@ -96,7 +96,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
|
|||
}
|
||||
Some((_, stability, _)) => {
|
||||
if let Err(reason) =
|
||||
stability.compute_toggleability(&sess.target).allow_toggle()
|
||||
stability.toggle_allowed(&sess.target, enable_disable == '+')
|
||||
{
|
||||
sess.dcx().emit_warn(ForbiddenCTargetFeature { feature, reason });
|
||||
} else if stability.requires_nightly().is_some() {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue