From 1288a35fd5108baa4eecb3704a3890f42e34f372 Mon Sep 17 00:00:00 2001 From: Pedro Arruda Date: Tue, 30 Jul 2024 15:51:29 -0300 Subject: [PATCH] deprecate lazy_static + force latest rust on macos --- .github/workflows/release.yaml | 12 ++++++++++++ Cargo.lock | 1 - jyafn/Cargo.toml | 1 - jyafn/src/graph/compile/qbe_app.rs | 7 ++----- jyafn/src/pfunc.rs | 9 +++------ 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2311567..3d28b03 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -71,6 +71,10 @@ jobs: uses: actions/checkout@v4 with: ref: stable + - name: Install latest rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable - name: Build shared object run: | make cjyafn @@ -89,6 +93,10 @@ jobs: uses: actions/checkout@v4 with: ref: stable + - name: Install latest rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable - name: Prepare the machine run: | pip install maturin @@ -110,6 +118,10 @@ jobs: uses: actions/checkout@v4 with: ref: stable + - name: Install latest rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable - name: Build extensions run: | cd jyafn-ext diff --git a/Cargo.lock b/Cargo.lock index 9c5f180..1066a09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -706,7 +706,6 @@ dependencies = [ "glob", "hashbrown 0.14.5", "home", - "lazy_static", "libloading", "qbe", "rand", diff --git a/jyafn/Cargo.toml b/jyafn/Cargo.toml index ec0a468..207e052 100644 --- a/jyafn/Cargo.toml +++ b/jyafn/Cargo.toml @@ -21,7 +21,6 @@ get-size = { version = "0.1.4", features = ["derive"] } glob = "0.3.1" hashbrown = { version = "0.14.3", features = ["serde", "raw"] } home = "0.5.9" -lazy_static = "1.4.0" libloading = "0.8.4" qbe = { path = "../vendored/qbe-rs" } rand = "0.8.5" diff --git a/jyafn/src/graph/compile/qbe_app.rs b/jyafn/src/graph/compile/qbe_app.rs index ef47594..9ece619 100644 --- a/jyafn/src/graph/compile/qbe_app.rs +++ b/jyafn/src/graph/compile/qbe_app.rs @@ -1,14 +1,11 @@ -use lazy_static::lazy_static; use rand::random; use std::path::PathBuf; -use std::sync::Mutex; +use std::sync::{LazyLock, Mutex}; use std::{env, fs, io}; const BIN: &[u8] = include_bytes!("../../../../vendored/qbe/qbe"); -lazy_static! { - static ref CURRENT_QBE: Mutex> = Mutex::default(); -} +static CURRENT_QBE: LazyLock>> = LazyLock::new(Mutex::default); #[cfg(unix)] fn load() -> Result { diff --git a/jyafn/src/pfunc.rs b/jyafn/src/pfunc.rs index d4b0180..6efb948 100644 --- a/jyafn/src/pfunc.rs +++ b/jyafn/src/pfunc.rs @@ -1,9 +1,8 @@ //! _Pure_ functions that operate on raw jyafn data. use chrono::prelude::*; -use lazy_static::lazy_static; use special_fun::FloatSpecial; -use std::collections::HashMap; +use std::{collections::HashMap, sync::LazyLock}; use std::ops::Rem; use std::sync::RwLock; @@ -149,10 +148,8 @@ impl PFunc { } } -lazy_static! { - /// All the known [`PFunc`]s. - static ref P_FUNCS: RwLock> = RwLock::new(init()); -} +/// All the known [`PFunc`]s. +static P_FUNCS: LazyLock>> = LazyLock::new(|| RwLock::new(init())); /// Inscribes a new pure function. ///