1
0
forked from ROMEO/nexosim

Move loom as a dev-dependency

This commit is contained in:
Serge Barral 2024-09-07 19:53:30 +02:00
parent e75edcbd33
commit 114c148114
3 changed files with 10 additions and 12 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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};
@ -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};
@ -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>);