Skip to content

Commit

Permalink
Upgrade cfg-expr to 0.12.0
Browse files Browse the repository at this point in the history
To get support for parsing target_abi. See:

<EmbarkStudios/cfg-expr#52>
<EmbarkStudios/cfg-expr#54>

This gets the new target_abi test to pass.
  • Loading branch information
carols10cents authored and sunshowers committed Nov 7, 2022
1 parent a4555d3 commit bb304ee
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion target-spec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rustdoc-args = ["--cfg=doc_cfg"]
maintenance = { status = "actively-developed" }

[dependencies]
cfg-expr = { version = "0.11.0", features = ["targets"] }
cfg-expr = { version = "0.12.0", features = ["targets"] }
proptest = { version = "1.0.0", optional = true }
serde = { version = "1.0.147", optional = true, features = ["derive"] }
target-lexicon = { version = "0.12.4", features = ["std"] }
Expand Down
23 changes: 18 additions & 5 deletions target-spec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl FromStr for TargetExpression {
mod tests {
use super::*;
use cfg_expr::{
targets::{Family, Os},
targets::{Abi, Arch, Family, Os},
Predicate, TargetPredicate,
};

Expand Down Expand Up @@ -178,10 +178,23 @@ mod tests {

#[test]
fn test_target_abi() {
assert!(matches!(
TargetSpec::new("cfg(any(target_arch = \"wasm32\", target_abi = \"unknown\"))"),
Ok(TargetSpec::Expression(_))
));
let expr =
match TargetSpec::new("cfg(any(target_arch = \"wasm32\", target_abi = \"unknown\"))")
.unwrap()
{
TargetSpec::Triple(triple) => {
panic!("expected expression, got triple: {:?}", triple)
}
TargetSpec::Expression(expr) => expr,
};

assert_eq!(
expr.inner.predicates().collect::<Vec<_>>(),
vec![
Predicate::Target(TargetPredicate::Arch(Arch("wasm32".into()))),
Predicate::Target(TargetPredicate::Abi(Abi("unknown".into()))),
],
);
}

#[test]
Expand Down

0 comments on commit bb304ee

Please sign in to comment.