Skip to content

Commit

Permalink
Update to 1.76.0 (#67)
Browse files Browse the repository at this point in the history
* Remove xcrun hack

rust-lang/rust#36156 was apparently resolved years ago, so the hack is no longer needed

* Fixup update script

1.76.0 introduced a few new target keys, but they are experimental and thus not worth supporting until/if they are stabilized.

Also aarch64-apple-watchos was added but does not print in stable due to an LLVM call failing, but does work on nightly, so we use nightly for that ONE target

* Update builtins to 1.76.0

* Fix tests

* Fix lints
  • Loading branch information
Jake-Shadle authored Feb 9, 2024
1 parent c252d79 commit 9e04098
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 99 deletions.
2 changes: 1 addition & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ impl Expression {

/// Evaluates the expression, using the provided closure to determine the value of
/// each predicate, which are then combined into a final result depending on the
/// functions not(), all(), or any() in the expression.
/// functions `not()`, `all()`, or `any()` in the expression.
///
/// `eval_predicate` typically returns `bool`, but may return any type that implements
/// the `Logic` trait.
Expand Down
2 changes: 1 addition & 1 deletion src/expr/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
use smallvec::SmallVec;

impl Expression {
/// Given a cfg() expression (the cfg( and ) are optional), attempts to
/// Given a `cfg()` expression (the cfg( and ) are optional), attempts to
/// parse it into a form where it can be evaluated
///
/// ```
Expand Down
4 changes: 2 additions & 2 deletions src/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ pub fn get_builtin_target_by_triple(triple: &str) -> Option<&'static TargetInfo>
/// versions.
///
/// ```
/// assert_eq!("1.75.0", cfg_expr::targets::rustc_version());
/// assert_eq!("1.76.0", cfg_expr::targets::rustc_version());
/// ```
pub fn rustc_version() -> &'static str {
builtins::RUSTC_VERSION
Expand All @@ -397,7 +397,7 @@ mod test {
#[test]
fn has_ios() {
assert_eq!(
7,
8,
super::ALL_BUILTINS
.iter()
.filter(|ti| ti.os == Some(super::Os::ios))
Expand Down
107 changes: 80 additions & 27 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.75.0";
pub(crate) const RUSTC_VERSION: &str = "1.76.0";

pub const ALL_BUILTINS: &[TargetInfo] = &[
TargetInfo {
Expand Down Expand Up @@ -91,6 +91,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("aarch64-apple-watchos"),
os: Some(Os::watchos),
abi: None,
arch: Arch::aarch64,
env: None,
vendor: Some(Vendor::apple),
families: Families::unix,
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("aarch64-apple-watchos-sim"),
os: Some(Os::watchos),
Expand Down Expand Up @@ -520,6 +533,32 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("arm64e-apple-darwin"),
os: Some(Os::macos),
abi: None,
arch: Arch::aarch64,
env: None,
vendor: Some(Vendor::apple),
families: Families::unix,
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("arm64e-apple-ios"),
os: Some(Os::ios),
abi: None,
arch: Arch::aarch64,
env: None,
vendor: Some(Vendor::apple),
families: Families::unix,
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("armeb-unknown-linux-gnueabi"),
os: Some(Os::linux),
Expand Down Expand Up @@ -936,19 +975,6 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("asmjs-unknown-emscripten"),
os: Some(Os::emscripten),
abi: None,
arch: Arch::wasm32,
env: None,
vendor: Some(Vendor::unknown),
families: Families::unix_wasm,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("avr-unknown-gnu-atmega328"),
os: None,
Expand Down Expand Up @@ -1300,6 +1326,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("i686-win7-windows-msvc"),
os: Some(Os::windows),
abi: None,
arch: Arch::x86,
env: Some(Env::msvc),
vendor: Some(Vendor::win7),
families: Families::windows,
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("i686-wrs-vxworks"),
os: Some(Os::vxworks),
Expand Down Expand Up @@ -1948,6 +1987,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
pointer_width: 32,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("riscv32imafc-unknown-none-elf"),
os: None,
abi: None,
arch: Arch::riscv32,
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 {
Expand Down Expand Up @@ -2626,19 +2678,6 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("x86_64-sun-solaris"),
os: Some(Os::solaris),
abi: None,
arch: Arch::x86_64,
env: None,
vendor: Some(Vendor::sun),
families: Families::unix,
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("x86_64-unikraft-linux-musl"),
os: Some(Os::linux),
Expand Down Expand Up @@ -2886,6 +2925,19 @@ pub const ALL_BUILTINS: &[TargetInfo] = &[
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("x86_64-win7-windows-msvc"),
os: Some(Os::windows),
abi: None,
arch: Arch::x86_64,
env: Some(Env::msvc),
vendor: Some(Vendor::win7),
families: Families::windows,
pointer_width: 64,
endian: Endian::little,
has_atomics: HasAtomics::atomic_8_16_32_64_ptr,
panic: Panic::unwind,
},
TargetInfo {
triple: Triple::new_const("x86_64-wrs-vxworks"),
os: Some(Os::vxworks),
Expand Down Expand Up @@ -2958,6 +3010,7 @@ impl super::Vendor {
pub const unikraft: Vendor = Vendor::new_const("unikraft");
pub const unknown: Vendor = Vendor::new_const("unknown");
pub const uwp: Vendor = Vendor::new_const("uwp");
pub const win7: Vendor = Vendor::new_const("win7");
pub const wrs: Vendor = Vendor::new_const("wrs");
}

Expand Down
8 changes: 4 additions & 4 deletions tests/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ fn very_specific() {
for target in all {
let t = Target::make(target.triple.as_str());
assert_eq!(
target.triple.as_str() == "i686-pc-windows-msvc"
|| target.triple.as_str() == "i586-pc-windows-msvc",
matches!(
target.triple.as_str(),
"i686-pc-windows-msvc" | "i586-pc-windows-msvc" | "i686-win7-windows-msvc"
),
specific.eval(|pred| { tg_match!(pred, t, &["fxsr", "sse", "sse2"]) }),
"expected true for i686-pc-windows-msvc, but got true for {}",
target.triple,
Expand Down Expand Up @@ -317,14 +319,12 @@ fn unstable_target_abi() {
fn wasm_family() {
let wasm = Expression::parse(r#"cfg(target_family = "wasm")"#).unwrap();

let asmjs_emscripten = Target::make("asmjs-unknown-emscripten");
let wasm32_unknown = Target::make("wasm32-unknown-unknown");
let wasm32_emscripten = Target::make("wasm32-unknown-emscripten");
let wasm32_wasi = Target::make("wasm32-wasi");
let wasm64_unknown = Target::make("wasm64-unknown-unknown");

// All of the above targets match.
assert!(wasm.eval(|pred| tg_match!(pred, asmjs_emscripten)));
assert!(wasm.eval(|pred| tg_match!(pred, wasm32_unknown)));
assert!(wasm.eval(|pred| tg_match!(pred, wasm32_emscripten)));
assert!(wasm.eval(|pred| tg_match!(pred, wasm32_wasi)));
Expand Down
6 changes: 1 addition & 5 deletions update/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@
name = "update"
version = "0.1.0"
authors = ["Jake Shadle <[email protected]>"]
edition = "2018"

[[bin]]
name = "xcrun"
path = "src/main.rs"
edition = "2021"
Loading

0 comments on commit 9e04098

Please sign in to comment.