From 1c46e6e57b7a8fe6f774eca461b25ef0a3dc0cc3 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 6 Sep 2024 00:38:43 +0200 Subject: [PATCH] Update target list to 1.81.0 --- README.md | 8 ++-- src/expr.rs | 7 ++- src/targets/builtins.rs | 101 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 106 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1c5541f..ddc8882 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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}; @@ -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) diff --git a/src/expr.rs b/src/expr.rs index 30d0c9f..f6caa09 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -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!( @@ -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 } diff --git a/src/targets/builtins.rs b/src/targets/builtins.rs index 543b5f6..5babbe4 100644 --- a/src/targets/builtins.rs +++ b/src/targets/builtins.rs @@ -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 { @@ -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), @@ -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, @@ -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, @@ -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, @@ -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 { @@ -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 { @@ -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");