From 5f88676dd00a6648578b74e1b018f4c944d0a93e Mon Sep 17 00:00:00 2001 From: taks <857tn859@gmail.com> Date: Sun, 19 Nov 2023 00:58:13 +0900 Subject: [PATCH 1/6] Use portable_atomic instead of atomic-polyfill --- Cargo.toml | 7 ++----- src/imp_cs.rs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9d4189b..7c8443c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ members = ["xtask"] [dependencies] parking_lot_core = { version = "0.9.3", optional = true, default_features = false } -atomic-polyfill = { version = "1", optional = true } +portable-atomic = { version = "1", optional = true } critical-section = { version = "1", optional = true } [dev-dependencies] @@ -48,15 +48,12 @@ parking_lot = ["dep:parking_lot_core"] # Uses `critical-section` to implement `sync` and `race` modules. in # `#![no_std]` mode. Please read `critical-section` docs carefully # before enabling this feature. -critical-section = ["dep:critical-section", "dep:atomic-polyfill" ] +critical-section = ["dep:critical-section", "portable-atomic" ] # Enables semver-exempt APIs of this crate. # At the moment, this feature is unused. unstable = [] -# Only for backwards compatibility. -atomic-polyfill = ["critical-section"] - [[example]] name = "bench" required-features = ["std"] diff --git a/src/imp_cs.rs b/src/imp_cs.rs index 04018f1..7d05e50 100644 --- a/src/imp_cs.rs +++ b/src/imp_cs.rs @@ -1,6 +1,6 @@ use core::panic::{RefUnwindSafe, UnwindSafe}; -use atomic_polyfill::{AtomicBool, Ordering}; +use portable_atomic::{AtomicBool, Ordering}; use critical_section::{CriticalSection, Mutex}; use crate::unsync; From e26736f1f785f2c05f54d857b2876688f3fa5702 Mon Sep 17 00:00:00 2001 From: taks <857tn859@gmail.com> Date: Thu, 7 Dec 2023 19:11:57 +0900 Subject: [PATCH 2/6] Fix CI --- src/race.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/race.rs b/src/race.rs index fe36fa1..da8a2fc 100644 --- a/src/race.rs +++ b/src/race.rs @@ -20,7 +20,7 @@ //! architectures versus `Relaxed`. #[cfg(feature = "critical-section")] -use atomic_polyfill as atomic; +use portable_atomic as atomic; #[cfg(not(feature = "critical-section"))] use core::sync::atomic; From de4cd9db5362123997baa9b40a015024b67b65a3 Mon Sep 17 00:00:00 2001 From: taks <857tn859@gmail.com> Date: Thu, 7 Dec 2023 19:15:47 +0900 Subject: [PATCH 3/6] Revert atomic-polyfill feature --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 7c8443c..2823a08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,9 @@ critical-section = ["dep:critical-section", "portable-atomic" ] # At the moment, this feature is unused. unstable = [] +# Only for backwards compatibility. +atomic-polyfill = ["critical-section"] + [[example]] name = "bench" required-features = ["std"] From dffcae4440f459184a345042a57dea26693b4c65 Mon Sep 17 00:00:00 2001 From: taks <857tn859@gmail.com> Date: Thu, 7 Dec 2023 19:21:35 +0900 Subject: [PATCH 4/6] Fix CI --- Cargo.lock.msrv | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 08e2a1e..2b7872f 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -11,15 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "atomic-polyfill" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c314e70d181aa6053b26e3f7fbf86d1dfff84f816a6175b967666b3506ef7289" -dependencies = [ - "critical-section", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -54,9 +45,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" name = "once_cell" version = "1.18.0" dependencies = [ - "atomic-polyfill", "critical-section", "parking_lot_core", + "portable-atomic", "regex", ] @@ -73,6 +64,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "redox_syscall" version = "0.2.16" From 2715aa9896ed6d0e810d350e6db4e0c5076a9df9 Mon Sep 17 00:00:00 2001 From: taks <857tn859@gmail.com> Date: Thu, 7 Dec 2023 19:35:11 +0900 Subject: [PATCH 5/6] v1.19.0 --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cb846a..66d27e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ - +## 1.19.0 + +- Use `portable-atomic` instead of `atomic-polyfill`, [#251](https://github.com/matklad/once_cell/pull/251). + ## 1.18.0 - `MSRV` is updated to 1.60.0 to take advantage of `dep:` syntax for cargo features, diff --git a/Cargo.toml b/Cargo.toml index 2823a08..e41e06e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "once_cell" -version = "1.18.0" +version = "1.19.0" authors = ["Aleksey Kladov "] license = "MIT OR Apache-2.0" edition = "2021" From 8211d807891b9b1ccae3d83cafa582b6b73208a7 Mon Sep 17 00:00:00 2001 From: taks <857tn859@gmail.com> Date: Thu, 7 Dec 2023 19:41:04 +0900 Subject: [PATCH 6/6] Fix CI --- Cargo.lock.msrv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 2b7872f..d3f878f 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -43,7 +43,7 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" dependencies = [ "critical-section", "parking_lot_core",