Skip to content

Commit

Permalink
Update target list to 1.81.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Sep 5, 2024
1 parent 3e7dd14 commit 1c46e6e
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 10 deletions.
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.80.0] are supported.**
**A parser and evaluator for Rust `cfg()` expressions. Builtin targets as of [1.81.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.80.0-blue.svg)](https://forge.rust-lang.org/release/platform-support.html)
[![Rust Targets](https://img.shields.io/badge/Rust%20Targets-1.81.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.80.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.81.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.80.0]: (https://forge.rust-lang.org/release/platform-support.html)
[1.81.0]: (https://forge.rust-lang.org/release/platform-support.html)
7 changes: 5 additions & 2 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ impl TargetMatcher for target_lexicon::Triple {
Environment::LinuxKernel => env == &targ::Env::gnu,
_ => env.0.is_empty(),
},
OperatingSystem::WasiP1 => env.0.is_empty(),
OperatingSystem::WasiP1 => env == &targ::Env::p1,
OperatingSystem::WasiP2 => env == &targ::Env::p2,
OperatingSystem::Wasi => env.0.is_empty() || env == &targ::Env::p1,
_ => {
if env.0.is_empty() {
matches!(
Expand Down Expand Up @@ -367,7 +368,9 @@ impl TargetMatcher for target_lexicon::Triple {
if self.vendor == v {
true
} else if let target_lexicon::Vendor::Custom(custom) = &self.vendor {
custom.as_str() == "esp" && v == target_lexicon::Vendor::Espressif
matches!(custom.as_str(), "esp" | "esp32" | "esp32s2" | "esp32s3")
&& (v == target_lexicon::Vendor::Espressif
|| v == target_lexicon::Vendor::Unknown)
} else {
false
}
Expand Down
101 changes: 97 additions & 4 deletions 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.80.0";
pub(crate) const RUSTC_VERSION: &str = "1.81.0";

pub const ALL_BUILTINS: &[TargetInfo] = &[
TargetInfo {
Expand Down Expand Up @@ -1365,6 +1365,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("i686-unknown-redox"),
os: Some(Os::redox),
abi: None,
arch: Arch::x86,
env: Some(Env::relibc),
vendor: Some(Vendor::unknown),
families: Families::unix,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("i686-unknown-uefi"),
os: Some(Os::uefi),
Expand Down Expand Up @@ -2605,7 +2618,7 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
os: Some(Os::wasi),
abi: None,
arch: Arch::wasm32,
env: None,
env: Some(Env::p1),
vendor: Some(Vendor::unknown),
families: Families::wasm,
pointer_width: 32,
Expand All @@ -2618,7 +2631,7 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
os: Some(Os::wasi),
abi: None,
arch: Arch::wasm32,
env: None,
env: Some(Env::p1),
vendor: Some(Vendor::unknown),
families: Families::wasm,
pointer_width: 32,
Expand All @@ -2631,7 +2644,7 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
os: Some(Os::wasi),
abi: None,
arch: Arch::wasm32,
env: None,
env: Some(Env::p1),
vendor: Some(Vendor::unknown),
families: Families::wasm,
pointer_width: 32,
Expand Down Expand Up @@ -3133,6 +3146,84 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("xtensa-esp32-espidf"),
os: Some(Os::espidf),
abi: None,
arch: Arch::xtensa,
env: Some(Env::newlib),
vendor: Some(Vendor::espressif),
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("xtensa-esp32-none-elf"),
os: None,
abi: None,
arch: Arch::xtensa,
env: None,
vendor: Some(Vendor::unknown),
families: Families::new_const(&[]),
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("xtensa-esp32s2-espidf"),
os: Some(Os::espidf),
abi: None,
arch: Arch::xtensa,
env: Some(Env::newlib),
vendor: Some(Vendor::espressif),
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("xtensa-esp32s2-none-elf"),
os: None,
abi: None,
arch: Arch::xtensa,
env: None,
vendor: Some(Vendor::unknown),
families: Families::new_const(&[]),
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::new_const(&[]),
panic: Panic::abort,
},
TargetInfo {
triple: Triple::new_const("xtensa-esp32s3-espidf"),
os: Some(Os::espidf),
abi: None,
arch: Arch::xtensa,
env: Some(Env::newlib),
vendor: Some(Vendor::espressif),
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("xtensa-esp32s3-none-elf"),
os: None,
abi: None,
arch: Arch::xtensa,
env: None,
vendor: Some(Vendor::unknown),
families: Families::new_const(&[]),
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::abort,
},
];

impl super::Abi {
Expand Down Expand Up @@ -3181,6 +3272,7 @@ impl super::Arch {
pub const wasm64: Arch = Arch::new_const("wasm64");
pub const x86: Arch = Arch::new_const("x86");
pub const x86_64: Arch = Arch::new_const("x86_64");
pub const xtensa: Arch = Arch::new_const("xtensa");
}

impl super::Vendor {
Expand Down Expand Up @@ -3267,6 +3359,7 @@ impl super::Env {
pub const nto70: Env = Env::new_const("nto70");
pub const nto71: Env = Env::new_const("nto71");
pub const ohos: Env = Env::new_const("ohos");
pub const p1: Env = Env::new_const("p1");
pub const p2: Env = Env::new_const("p2");
pub const psx: Env = Env::new_const("psx");
pub const relibc: Env = Env::new_const("relibc");
Expand Down

0 comments on commit 1c46e6e

Please sign in to comment.