Skip to content

Commit

Permalink
Keep unstable target features for asm feature checking
Browse files Browse the repository at this point in the history
Inline assembly uses the target features to determine which registers
are available on the current target. However it needs to be able to
access unstable target features for this.

Fixes rust-lang#99071
  • Loading branch information
Amanieu committed Jul 11, 2022
1 parent a513b2a commit c98d66c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ impl CodegenBackend for GccCodegenBackend {
)
}

fn target_features(&self, sess: &Session) -> Vec<Symbol> {
target_features(sess)
fn target_features(&self, sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
target_features(sess, allow_unstable)
}
}

Expand Down Expand Up @@ -291,12 +291,12 @@ pub fn target_cpu(sess: &Session) -> &str {
}
}

pub fn target_features(sess: &Session) -> Vec<Symbol> {
pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
supported_target_features(sess)
.iter()
.filter_map(
|&(feature, gate)| {
if sess.is_nightly_build() || gate.is_none() { Some(feature) } else { None }
if sess.is_nightly_build() || allow_unstable || gate.is_none() { Some(feature) } else { None }
},
)
.filter(|_feature| {
Expand Down

0 comments on commit c98d66c

Please sign in to comment.