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 6058991 commit 56fb0b5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
# 1.60 is the cfg-expr version
toolchain: 1.64.0
# 1.65 is the cfg-expr version
toolchain: 1.65.0
override: true
- uses: Swatinem/rust-cache@v2
- name: Build and test
Expand Down
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 56fb0b5

Please sign in to comment.