Skip to content

Commit

Permalink
Update to 1.82.0 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle authored Nov 15, 2024
1 parent 4584e41 commit 26b0575
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- next-header -->
## [Unreleased] - ReleaseDate
### Changed
- [PR#75](https://github.com/EmbarkStudios/cfg-expr/pull/75) updated the builtin target list to 1.82.0.

## [0.17.0] - 2024-09-05
### Changed
- [PR#74](https://github.com/EmbarkStudios/cfg-expr/pull/74) updated the builtin target list to 1.81.0.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

# `⚙️ cfg-expr`

**A parser and evaluator for Rust `cfg()` expressions. Builtin targets as of [1.81.0] are supported.**
**A parser and evaluator for Rust `cfg()` expressions. Builtin targets as of [1.82.0] are supported.**

[![Build Status](https://github.com/EmbarkStudios/cfg-expr/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/cfg-expr/actions?workflow=CI)
[![Crates.io](https://img.shields.io/crates/v/cfg-expr.svg)](https://crates.io/crates/cfg-expr)
[![Docs](https://docs.rs/cfg-expr/badge.svg)](https://docs.rs/cfg-expr)
[![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)
[![Rust Targets](https://img.shields.io/badge/Rust%20Targets-1.81.0-blue.svg)](https://forge.rust-lang.org/release/platform-support.html)
[![Rust Targets](https://img.shields.io/badge/Rust%20Targets-1.82.0-blue.svg)](https://forge.rust-lang.org/release/platform-support.html)
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
[![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev)
</div>
Expand All @@ -24,7 +24,7 @@

`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.

It contains a list of all builtin targets known to rustc as of [1.81.0] that can be used to determine if a particular cfg expression is satisfiable.
It contains a list of all builtin targets known to rustc as of [1.82.0] that can be used to determine if a particular cfg expression is satisfiable.

```rust
use cfg_expr::{targets::get_builtin_target_by_triple, Expression, Predicate};
Expand Down Expand Up @@ -110,4 +110,4 @@ at your option.

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.

[1.81.0]: (https://forge.rust-lang.org/release/platform-support.html)
[1.82.0]: (https://forge.rust-lang.org/release/platform-support.html)
9 changes: 8 additions & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ impl TargetMatcher for target_lexicon::Triple {
Abi, Arch, Endian, Env, Family, HasAtomic, Os, Panic, PointerWidth, Vendor,
};

const NUTTX: target_lexicon::Vendor =
target_lexicon::Vendor::Custom(target_lexicon::CustomVendor::Static("nuttx"));

match tp {
Abi(_) => {
// `target_abi` is unstable. Assume false for this.
Expand Down Expand Up @@ -267,6 +270,7 @@ impl TargetMatcher for target_lexicon::Triple {
MacOSX, Nebulet, Netbsd, None_, Openbsd, Redox, Solaris, Tvos, Uefi, Unknown,
Visionos, VxWorks, Wasi, WasiP1, WasiP2, Watchos, Windows,
};

match self.operating_system {
AmdHsa | Bitrig | Cloudabi | Cuda | Hermit | Nebulet | None_ | Uefi => false,
Aix
Expand Down Expand Up @@ -300,6 +304,7 @@ impl TargetMatcher for target_lexicon::Triple {
_ => false,
}
}
Unknown if self.vendor == NUTTX => fam == &crate::targets::Family::unix,
Unknown => {
// asmjs, wasm32 and wasm64 are part of the wasm family.
match self.architecture {
Expand Down Expand Up @@ -334,9 +339,11 @@ impl TargetMatcher for target_lexicon::Triple {
self.operating_system,
OperatingSystem::WasiP1 | OperatingSystem::WasiP2
)
|| os == &targ::Os::nuttx && self.vendor == NUTTX
{
return true;
}

match os.0.parse::<OperatingSystem>() {
Ok(o) => match self.environment {
Environment::HermitKernel => os == &targ::Os::hermit,
Expand Down Expand Up @@ -365,7 +372,7 @@ impl TargetMatcher for target_lexicon::Triple {
}
Vendor(ven) => match ven.0.parse::<target_lexicon::Vendor>() {
Ok(v) => {
if self.vendor == v {
if self.vendor == v || self.vendor == NUTTX && ven == &targ::Vendor::unknown {
true
} else if let target_lexicon::Vendor::Custom(custom) = &self.vendor {
matches!(custom.as_str(), "esp" | "esp32" | "esp32s2" | "esp32s3")
Expand Down
199 changes: 198 additions & 1 deletion src/targets/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use super::*;

pub(crate) const RUSTC_VERSION: &str = "1.81.0";
pub(crate) const RUSTC_VERSION: &str = "1.82.0";

pub const ALL_BUILTINS: &[TargetInfo] = &[
TargetInfo {
Expand Down Expand Up @@ -416,6 +416,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("aarch64-unknown-trusty"),
os: Some(Os::trusty),
abi: None,
arch: Arch::aarch64,
env: None,
vendor: Some(Vendor::unknown),
families: Families::new_const(&[]),
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("aarch64-unknown-uefi"),
os: Some(Os::uefi),
Expand Down Expand Up @@ -910,6 +923,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("armv7-unknown-trusty"),
os: Some(Os::trusty),
abi: Some(Abi::eabi),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::new_const(&[]),
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("armv7-wrs-vxworks-eabihf"),
os: Some(Os::vxworks),
Expand Down Expand Up @@ -1833,6 +1859,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("powerpc-unknown-linux-muslspe"),
os: Some(Os::linux),
abi: Some(Abi::spe),
arch: Arch::powerpc,
env: Some(Env::musl),
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::big,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("powerpc-unknown-netbsd"),
os: Some(Os::netbsd),
Expand Down Expand Up @@ -2106,6 +2145,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("riscv32imac-unknown-nuttx-elf"),
os: Some(Os::nuttx),
abi: None,
arch: Arch::riscv32,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("riscv32imac-unknown-xous-elf"),
os: Some(Os::xous),
Expand Down Expand Up @@ -2145,6 +2197,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("riscv32imafc-unknown-nuttx-elf"),
os: Some(Os::nuttx),
abi: None,
arch: Arch::riscv32,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("riscv32imc-esp-espidf"),
os: Some(Os::espidf),
Expand All @@ -2171,6 +2236,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::new_const(&[]),
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("riscv32imc-unknown-nuttx-elf"),
os: Some(Os::nuttx),
abi: None,
arch: Arch::riscv32,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("riscv64-linux-android"),
os: Some(Os::android),
Expand Down Expand Up @@ -2275,6 +2353,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("riscv64gc-unknown-nuttx-elf"),
os: Some(Os::nuttx),
abi: None,
arch: Arch::riscv64,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("riscv64gc-unknown-openbsd"),
os: Some(Os::openbsd),
Expand All @@ -2301,6 +2392,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("riscv64imac-unknown-nuttx-elf"),
os: Some(Os::nuttx),
abi: None,
arch: Arch::riscv64,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("s390x-unknown-linux-gnu"),
os: Some(Os::linux),
Expand Down Expand Up @@ -2444,6 +2548,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::new_const(&[]),
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv6m-nuttx-eabi"),
os: Some(Os::nuttx),
abi: Some(Abi::eabi),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::new_const(&[]),
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv7a-pc-windows-msvc"),
os: Some(Os::windows),
Expand Down Expand Up @@ -2496,6 +2613,32 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv7em-nuttx-eabi"),
os: Some(Os::nuttx),
abi: Some(Abi::eabi),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv7em-nuttx-eabihf"),
os: Some(Os::nuttx),
abi: Some(Abi::eabihf),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv7m-none-eabi"),
os: None,
Expand All @@ -2509,6 +2652,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv7m-nuttx-eabi"),
os: Some(Os::nuttx),
abi: Some(Abi::eabi),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv7neon-linux-androideabi"),
os: Some(Os::android),
Expand Down Expand Up @@ -2561,6 +2717,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv8m.base-nuttx-eabi"),
os: Some(Os::nuttx),
abi: Some(Abi::eabi),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv8m.main-none-eabi"),
os: None,
Expand All @@ -2587,6 +2756,32 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv8m.main-nuttx-eabi"),
os: Some(Os::nuttx),
abi: Some(Abi::eabi),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("thumbv8m.main-nuttx-eabihf"),
os: Some(Os::nuttx),
abi: Some(Abi::eabihf),
arch: Arch::arm,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("wasm32-unknown-emscripten"),
os: Some(Os::emscripten),
Expand Down Expand Up @@ -3314,12 +3509,14 @@ impl super::Os {
pub const macos: Os = Os::new_const("macos");
pub const netbsd: Os = Os::new_const("netbsd");
pub const nto: Os = Os::new_const("nto");
pub const nuttx: Os = Os::new_const("nuttx");
pub const openbsd: Os = Os::new_const("openbsd");
pub const psp: Os = Os::new_const("psp");
pub const redox: Os = Os::new_const("redox");
pub const solaris: Os = Os::new_const("solaris");
pub const solid_asp3: Os = Os::new_const("solid_asp3");
pub const teeos: Os = Os::new_const("teeos");
pub const trusty: Os = Os::new_const("trusty");
pub const tvos: Os = Os::new_const("tvos");
pub const uefi: Os = Os::new_const("uefi");
pub const unknown: Os = Os::new_const("unknown");
Expand Down

0 comments on commit 26b0575

Please sign in to comment.