Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move loom as a dev-dependency #41

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions asynchronix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,21 @@ tonic = { version = "0.11", default-features = false, features=["codegen", "pros
# WASM service dependencies.
wasm-bindgen = { version = "0.2", optional = true }

[target.'cfg(asynchronix_loom)'.dependencies]
loom = "0.5"
waker-fn = "1.1"


[dev-dependencies]
atomic-wait = "1.1"
futures-util = "0.3"
futures-executor = "0.3"
mio = { version = "1.0", features = ["os-poll", "net"] }

[target.'cfg(asynchronix_loom)'.dev-dependencies]
loom = "0.5"
waker-fn = "1.1"

[build-dependencies]
tonic-build = { version = "0.11", optional = true }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(asynchronix_loom)'] }

[[test]]
name = "integration"
Expand Down
3 changes: 0 additions & 3 deletions asynchronix/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Prevent warnings when checking for flag `asynchronix_loom`.
println!("cargo::rustc-check-cfg=cfg(asynchronix_loom)");

#[cfg(feature = "rpc-codegen")]
let builder = tonic_build::configure()
.build_client(false)
Expand Down
8 changes: 4 additions & 4 deletions asynchronix/src/loom_exports.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(asynchronix_loom)]
#[cfg(all(test, asynchronix_loom))]
#[allow(unused_imports)]
pub(crate) mod sync {
pub(crate) use loom::sync::{Arc, LockResult, Mutex, MutexGuard};
Expand All @@ -10,7 +10,7 @@ pub(crate) mod sync {
};
}
}
#[cfg(not(asynchronix_loom))]
#[cfg(not(all(test, asynchronix_loom)))]
#[allow(unused_imports)]
pub(crate) mod sync {
pub(crate) use std::sync::{Arc, LockResult, Mutex, MutexGuard, PoisonError};
Expand All @@ -22,11 +22,11 @@ pub(crate) mod sync {
}
}

#[cfg(asynchronix_loom)]
#[cfg(all(test, asynchronix_loom))]
pub(crate) mod cell {
pub(crate) use loom::cell::UnsafeCell;
}
#[cfg(not(asynchronix_loom))]
#[cfg(not(all(test, asynchronix_loom)))]
pub(crate) mod cell {
#[derive(Debug)]
pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>);
Expand Down
Loading