From b433a8cc41f328912de7865ecfebb94e0851a76c Mon Sep 17 00:00:00 2001 From: "@brodycj - C. Jonathan Brody" Date: Mon, 2 Sep 2024 17:55:32 -0400 Subject: [PATCH 1/7] propagate critical-section feature selection into portable-atomic --- Cargo.lock.msrv | 3 +++ Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index d3f878f..6c688eb 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -69,6 +69,9 @@ name = "portable-atomic" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +dependencies = [ + "critical-section", +] [[package]] name = "redox_syscall" diff --git a/Cargo.toml b/Cargo.toml index e41e06e..a674409 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ 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", "portable-atomic" ] +critical-section = ["dep:critical-section", "portable-atomic/critical-section"] # Enables semver-exempt APIs of this crate. # At the moment, this feature is unused. From bb70b9e7e689ce2493b515dcc4a1d96088e9ad2f Mon Sep 17 00:00:00 2001 From: "@brodycj - C. Jonathan Brody" Date: Tue, 3 Sep 2024 12:26:57 -0400 Subject: [PATCH 2/7] cargo fmt updates --- src/imp_cs.rs | 2 +- src/race.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/imp_cs.rs b/src/imp_cs.rs index 7d05e50..6b8d53d 100644 --- a/src/imp_cs.rs +++ b/src/imp_cs.rs @@ -1,7 +1,7 @@ use core::panic::{RefUnwindSafe, UnwindSafe}; -use portable_atomic::{AtomicBool, Ordering}; use critical_section::{CriticalSection, Mutex}; +use portable_atomic::{AtomicBool, Ordering}; use crate::unsync; diff --git a/src/race.rs b/src/race.rs index da8a2fc..89e4367 100644 --- a/src/race.rs +++ b/src/race.rs @@ -19,10 +19,10 @@ //! `Acquire` and `Release` have very little performance overhead on most //! architectures versus `Relaxed`. -#[cfg(feature = "critical-section")] -use portable_atomic as atomic; #[cfg(not(feature = "critical-section"))] use core::sync::atomic; +#[cfg(feature = "critical-section")] +use portable_atomic as atomic; use atomic::{AtomicPtr, AtomicUsize, Ordering}; use core::cell::UnsafeCell; From bd54bf7aff264a2ea8d935e5da686471320a8322 Mon Sep 17 00:00:00 2001 From: "@brodycj - C. Jonathan Brody" Date: Tue, 3 Sep 2024 15:12:25 -0400 Subject: [PATCH 3/7] fix default-features flag for parking_lot_core in dependencies --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a674409..5e60fdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ exclude = ["*.png", "*.svg", "/Cargo.lock.msrv", "rustfmt.toml"] members = ["xtask"] [dependencies] -parking_lot_core = { version = "0.9.3", optional = true, default_features = false } +parking_lot_core = { version = "0.9.3", optional = true, default-features = false } portable-atomic = { version = "1", optional = true } critical-section = { version = "1", optional = true } From 7317eae758ff76ec7681caf231397f234059aa3d Mon Sep 17 00:00:00 2001 From: "@brodycj - C. Jonathan Brody" Date: Fri, 13 Sep 2024 11:52:31 -0400 Subject: [PATCH 4/7] add `cargo test --workspace` to beginning of TEST task --- xtask/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index c3a0541..e8b5dde 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -21,6 +21,8 @@ fn main() -> xshell::Result<()> { { let _s = section("TEST"); + cmd!(sh, "cargo test --workspace").run()?; + for &release in &[None, Some("--release")] { cmd!(sh, "cargo test --features unstable {release...}").run()?; cmd!( From dd6b5c2909d3deccb6aabcb665de07c819411094 Mon Sep 17 00:00:00 2001 From: "@brodycj - C. Jonathan Brody" Date: Fri, 13 Sep 2024 14:36:05 -0400 Subject: [PATCH 5/7] ci: fix TEST_BETA with TEMPORARY WORKAROUND in RUSTFLAGS --- xtask/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index e8b5dde..36d86e4 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -43,6 +43,11 @@ fn main() -> xshell::Result<()> { { let _s = section("TEST_BETA"); let _e = push_toolchain(&sh, "beta")?; + // TEMPORARY WORKAROUND for Rust compiler issue ref: + // - https://github.com/rust-lang/rust/issues/129352 + // - https://github.com/matklad/once_cell/issues/261 + let _e = sh.push_env("RUSTFLAGS", "-A unreachable_patterns"); + cmd!(sh, "cargo test --features unstable").run()?; } From f2d95bfe79ee7f268e92d7105a95d12e06b6c748 Mon Sep 17 00:00:00 2001 From: "@brodycj - C. Jonathan Brody" Date: Fri, 13 Sep 2024 14:42:50 -0400 Subject: [PATCH 6/7] update Cargo (dev-)dependencies; update Cargo.lock.msrv --- Cargo.lock.msrv | 112 ++++++++++++++++++++++++++---------------------- Cargo.toml | 10 ++--- 2 files changed, 66 insertions(+), 56 deletions(-) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 6c688eb..087ca57 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -4,18 +4,18 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "cfg-if" @@ -25,21 +25,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "critical-section" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" +checksum = "f64009896348fc5af4222e9cf7d7d82a95a256c634ebcf61c53e4ea461422242" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "once_cell" @@ -53,76 +53,80 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-targets", ] [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" dependencies = [ "critical-section", ] [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.8.3" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", + "regex-automata", "regex-syntax", ] [[package]] -name = "regex-syntax" -version = "0.7.2" +name = "regex-automata" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] -name = "smallvec" -version = "1.10.0" +name = "regex-syntax" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] -name = "windows-sys" -version = "0.45.0" +name = "smallvec" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets", -] +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -131,60 +135,66 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "xshell" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962c039b3a7b16cf4e9a4248397c6585c07547412e7d6a6e035389a802dcfe90" +checksum = "6db0ab86eae739efd1b054a8d3d16041914030ac4e01cd1dca0cf252fd8b6437" dependencies = [ "xshell-macros", ] [[package]] name = "xshell-macros" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbabb1cbd15a1d6d12d9ed6b35cc6777d4af87ab3ba155ea37215f20beab80c" +checksum = "9d422e8e38ec76e2f06ee439ccc765e9c6a9638b9e7c9f2e8255e4d41e8bd852" [[package]] name = "xtask" diff --git a/Cargo.toml b/Cargo.toml index 5e60fdd..7c0db25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,13 +20,13 @@ exclude = ["*.png", "*.svg", "/Cargo.lock.msrv", "rustfmt.toml"] members = ["xtask"] [dependencies] -parking_lot_core = { version = "0.9.3", optional = true, default-features = false } -portable-atomic = { version = "1", optional = true } -critical-section = { version = "1", optional = true } +parking_lot_core = { version = "0.9.10", optional = true, default-features = false } +portable-atomic = { version = "1.7", optional = true } +critical-section = { version = "1.1.3", optional = true } [dev-dependencies] -regex = "1.2.0" -critical-section = { version = "1.1.1", features = ["std"] } +regex = "1.10.6" +critical-section = { version = "1.1.3", features = ["std"] } [features] default = ["std"] From be6b6238fb96da85cb0d5217f6121f4c2ba764e2 Mon Sep 17 00:00:00 2001 From: "@brodycj - C. Jonathan Brody" Date: Fri, 13 Sep 2024 14:51:31 -0400 Subject: [PATCH 7/7] v1.20.0 --- CHANGELOG.md | 4 ++++ Cargo.lock.msrv | 2 +- Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66d27e6..6c0e0a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ - +## 1.20.0 + +- propagate `critical-section` feature selection into `portable-atomic`; other minor updates [#260](https://github.com/matklad/once_cell/pull/260) + ## 1.19.0 - Use `portable-atomic` instead of `atomic-polyfill`, [#251](https://github.com/matklad/once_cell/pull/251). diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 087ca57..e2b0243 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -43,7 +43,7 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.0" dependencies = [ "critical-section", "parking_lot_core", diff --git a/Cargo.toml b/Cargo.toml index 7c0db25..e59b414 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "once_cell" -version = "1.19.0" +version = "1.20.0" authors = ["Aleksey Kladov "] license = "MIT OR Apache-2.0" edition = "2021"