1
0
forked from ROMEO/nexosim

Merge pull request #41 from asynchronics/feature/loom-as-dev-dependency

Move loom as a dev-dependency
This commit is contained in:
Serge Barral 2024-09-07 19:56:21 +02:00 committed by GitHub
commit 3ccf05335b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 service dependencies.
wasm-bindgen = { version = "0.2", optional = true } wasm-bindgen = { version = "0.2", optional = true }
[target.'cfg(asynchronix_loom)'.dependencies]
loom = "0.5"
waker-fn = "1.1"
[dev-dependencies] [dev-dependencies]
atomic-wait = "1.1" atomic-wait = "1.1"
futures-util = "0.3" futures-util = "0.3"
futures-executor = "0.3" futures-executor = "0.3"
mio = { version = "1.0", features = ["os-poll", "net"] } mio = { version = "1.0", features = ["os-poll", "net"] }
[target.'cfg(asynchronix_loom)'.dev-dependencies]
loom = "0.5"
waker-fn = "1.1"
[build-dependencies] [build-dependencies]
tonic-build = { version = "0.11", optional = true } tonic-build = { version = "0.11", optional = true }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(asynchronix_loom)'] }
[[test]] [[test]]
name = "integration" name = "integration"

View File

@ -1,7 +1,4 @@
fn main() -> Result<(), Box<dyn std::error::Error>> { 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")] #[cfg(feature = "rpc-codegen")]
let builder = tonic_build::configure() let builder = tonic_build::configure()
.build_client(false) .build_client(false)

View File

@ -1,4 +1,4 @@
#[cfg(asynchronix_loom)] #[cfg(all(test, asynchronix_loom))]
#[allow(unused_imports)] #[allow(unused_imports)]
pub(crate) mod sync { pub(crate) mod sync {
pub(crate) use loom::sync::{Arc, LockResult, Mutex, MutexGuard}; 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)] #[allow(unused_imports)]
pub(crate) mod sync { pub(crate) mod sync {
pub(crate) use std::sync::{Arc, LockResult, Mutex, MutexGuard, PoisonError}; 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) mod cell {
pub(crate) use loom::cell::UnsafeCell; pub(crate) use loom::cell::UnsafeCell;
} }
#[cfg(not(asynchronix_loom))] #[cfg(not(all(test, asynchronix_loom)))]
pub(crate) mod cell { pub(crate) mod cell {
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>); pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>);