From 59e93fc9523faaba7a6f6bae2d8dc1e22a6e1d2f Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sun, 31 Mar 2024 11:09:52 -0700 Subject: [PATCH] ci: Test loom under no-default-features This commit adds loom tests to CI with --no-default-features, then also fixes a compile error that was introduced in a new version of loom. Closes #64 --- .github/workflows/ci.yml | 5 +++++ src/sync.rs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 577b958..a7c3712 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,6 +107,11 @@ jobs: env: RUSTFLAGS: "--cfg=loom" LOOM_MAX_PREEMPTIONS: 4 + - name: Loom tests without default features + run: cargo test --release --test loom --features loom --no-default-features + env: + RUSTFLAGS: "--cfg=loom" + LOOM_MAX_PREEMPTIONS: 4 security_audit: permissions: diff --git a/src/sync.rs b/src/sync.rs index d6c4f0a..d1b0a89 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -36,6 +36,9 @@ mod sync_impl { pub(crate) use loom::sync::atomic::*; } + #[cfg(not(feature = "std"))] + pub(crate) use loom::hint::spin_loop; + #[cfg(feature = "std")] pub(crate) use loom::thread::yield_now; }