Skip to content

Commit a51e444

Browse files
authored
Update to 1.92.0 (#85)
1 parent 1dd1542 commit a51e444

File tree

4 files changed

+60
-7
lines changed

4 files changed

+60
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
<!-- next-header -->
1111
## [Unreleased] - ReleaseDate
12+
### Changed
13+
- [PR#85](https://github.com/EmbarkStudios/cfg-expr/pull/85) updated the builtin target list to 1.92.0.
14+
1215
## [0.20.4] - 2025-10-31
1316
### Changed
1417
- [PR#83](https://github.com/EmbarkStudios/cfg-expr/pull/83) updated the builtin target list to 1.91.0.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
# `⚙️ cfg-expr`
66

7-
**A parser and evaluator for Rust `cfg()` expressions. Builtin targets as of [1.91.0] are supported.**
7+
**A parser and evaluator for Rust `cfg()` expressions. Builtin targets as of [1.92.0] are supported.**
88

99
[![Build Status](https://github.com/EmbarkStudios/cfg-expr/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/cfg-expr/actions?workflow=CI)
1010
[![Crates.io](https://img.shields.io/crates/v/cfg-expr.svg)](https://crates.io/crates/cfg-expr)
1111
[![Docs](https://docs.rs/cfg-expr/badge.svg)](https://docs.rs/cfg-expr)
1212
[![Minimum Stable Rust Version](https://img.shields.io/badge/Rust%20MSRV-1.70.0-blue?color=fc8d62&logo=rust)](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html)
13-
[![Rust Targets](https://img.shields.io/badge/Rust%20Targets-1.91.0-blue.svg)](https://forge.rust-lang.org/release/platform-support.html)
13+
[![Rust Targets](https://img.shields.io/badge/Rust%20Targets-1.92.0-blue.svg)](https://forge.rust-lang.org/release/platform-support.html)
1414
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
1515
[![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev)
1616
</div>
@@ -24,7 +24,7 @@
2424

2525
`cfg-expr` is a crate that can be used to parse and evaluate Rust `cfg()` expressions, both as declarable in Rust code itself, as well in cargo manifests' `[target.'cfg()'.dependencies]` sections.
2626

27-
It contains a list of all builtin targets known to rustc as of [1.91.0] that can be used to determine if a particular cfg expression is satisfiable.
27+
It contains a list of all builtin targets known to rustc as of [1.92.0] that can be used to determine if a particular cfg expression is satisfiable.
2828

2929
```rust
3030
use cfg_expr::{targets::get_builtin_target_by_triple, Expression, Predicate};
@@ -100,4 +100,4 @@ at your option.
100100

101101
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
102102

103-
[1.91.0]: (https://forge.rust-lang.org/release/platform-support.html)
103+
[1.92.0]: (https://forge.rust-lang.org/release/platform-support.html)

src/expr.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl TargetMatcher for target_lexicon::Triple {
112112
const NUTTX: tl::Vendor = tl::Vendor::Custom(tl::CustomVendor::Static("nuttx"));
113113
const RTEMS: tl::Vendor = tl::Vendor::Custom(tl::CustomVendor::Static("rtems"));
114114
const WALI: tl::Vendor = tl::Vendor::Custom(tl::CustomVendor::Static("wali"));
115+
const WASIP3: tl::Vendor = tl::Vendor::Custom(tl::CustomVendor::Static("wasip3"));
115116

116117
match tp {
117118
Abi(_) => {
@@ -205,6 +206,8 @@ impl TargetMatcher for target_lexicon::Triple {
205206
| env::Sim
206207
| env::None
207208
)
209+
} else if env == &targ::Env::p3 {
210+
self.vendor == WASIP3
208211
} else {
209212
match env.0.parse::<env>() {
210213
Ok(e) => {
@@ -332,7 +335,9 @@ impl TargetMatcher for target_lexicon::Triple {
332335
false
333336
}
334337
Os(os) => {
335-
if os == &targ::Os::wasi && matches!(self.operating_system, os::WasiP1 | os::WasiP2)
338+
if os == &targ::Os::wasi
339+
&& (matches!(self.operating_system, os::WasiP1 | os::WasiP2)
340+
|| self.vendor == WASIP3)
336341
|| (os == &targ::Os::nuttx && self.vendor == NUTTX)
337342
|| (os == &targ::Os::rtems && self.vendor == RTEMS)
338343
{
@@ -367,7 +372,10 @@ impl TargetMatcher for target_lexicon::Triple {
367372
Vendor(ven) => match ven.0.parse::<target_lexicon::Vendor>() {
368373
Ok(v) => {
369374
if self.vendor == v
370-
|| ((self.vendor == NUTTX || self.vendor == RTEMS || self.vendor == WALI)
375+
|| ((self.vendor == NUTTX
376+
|| self.vendor == RTEMS
377+
|| self.vendor == WALI
378+
|| self.vendor == WASIP3)
371379
&& ven == &targ::Vendor::unknown)
372380
{
373381
true
@@ -700,6 +708,20 @@ impl PartialEq for Expression {
700708
}
701709
}
702710

711+
impl std::str::FromStr for Expression {
712+
type Err = crate::error::ParseError;
713+
714+
fn from_str(s: &str) -> Result<Self, Self::Err> {
715+
Expression::parse(s)
716+
}
717+
}
718+
719+
impl std::fmt::Display for Expression {
720+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
721+
f.write_str(&self.original)
722+
}
723+
}
724+
703725
/// A propositional logic used to evaluate `Expression` instances.
704726
///
705727
/// An `Expression` consists of some predicates and the `any`, `all` and `not` operators. An

src/targets/builtins.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use super::*;
1212

13-
pub(crate) const RUSTC_VERSION: &str = "1.91.0";
13+
pub(crate) const RUSTC_VERSION: &str = "1.92.0";
1414

1515
pub const ALL_BUILTINS: &[TargetInfo] = &[
1616
TargetInfo {
@@ -3224,6 +3224,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
32243224
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
32253225
panic: Panic::abort,
32263226
},
3227+
TargetInfo {
3228+
triple: Triple::new_const("wasm32-wasip3"),
3229+
os: Some(Os::wasi),
3230+
abi: None,
3231+
arch: Arch::wasm32,
3232+
env: Some(Env::p3),
3233+
vendor: Some(Vendor::unknown),
3234+
families: Families::wasm,
3235+
pointer_width: 32,
3236+
endian: Endian::little,
3237+
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
3238+
panic: Panic::abort,
3239+
},
32273240
TargetInfo {
32283241
triple: Triple::new_const("wasm32v1-none"),
32293242
os: None,
@@ -3653,6 +3666,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
36533666
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
36543667
panic: Panic::unwind,
36553668
},
3669+
TargetInfo {
3670+
triple: Triple::new_const("x86_64-unknown-motor"),
3671+
os: Some(Os::motor),
3672+
abi: None,
3673+
arch: Arch::x86_64,
3674+
env: None,
3675+
vendor: Some(Vendor::unknown),
3676+
families: Families::new_const(&[]),
3677+
pointer_width: 64,
3678+
endian: Endian::little,
3679+
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
3680+
panic: Panic::abort,
3681+
},
36563682
TargetInfo {
36573683
triple: Triple::new_const("x86_64-unknown-netbsd"),
36583684
os: Some(Os::netbsd),
@@ -3987,6 +4013,7 @@ impl super::Os {
39874013
pub const lynxos178: Os = Os::new_const("lynxos178");
39884014
pub const macos: Os = Os::new_const("macos");
39894015
pub const managarm: Os = Os::new_const("managarm");
4016+
pub const motor: Os = Os::new_const("motor");
39904017
pub const netbsd: Os = Os::new_const("netbsd");
39914018
pub const nto: Os = Os::new_const("nto");
39924019
pub const nuttx: Os = Os::new_const("nuttx");
@@ -4045,6 +4072,7 @@ impl super::Env {
40454072
pub const ohos: Env = Env::new_const("ohos");
40464073
pub const p1: Env = Env::new_const("p1");
40474074
pub const p2: Env = Env::new_const("p2");
4075+
pub const p3: Env = Env::new_const("p3");
40484076
pub const relibc: Env = Env::new_const("relibc");
40494077
pub const sgx: Env = Env::new_const("sgx");
40504078
pub const sim: Env = Env::new_const("sim");

0 commit comments

Comments
 (0)