Skip to content

Commit

Permalink
Merge pull request #9 from asynchronics/feature/loom-as-dev-dep
Browse files Browse the repository at this point in the history
Update Loom, make it a dev dependency
  • Loading branch information
sbarral authored Sep 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 93c0182 + 37a94a1 commit 3c02450
Showing 4 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ jobs:
matrix:
rust:
- stable
- 1.77.0
- 1.64.0
steps:
- name: Checkout sources
uses: actions/checkout@v4
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ name = "tachyonix"
version = "0.3.0"
authors = ["Serge Barral <serge.barral@asynchronics.com>"]
edition = "2021"
rust-version = "1.77"
rust-version = "1.56"
license = "MIT OR Apache-2.0"
repository = "https://github.com/asynchronics/tachyonix"
readme = "README.md"
@@ -20,24 +20,25 @@ keywords = ["async", "channel", "futures", "mpsc"]
autotests = false

[dependencies]
async-event = "0.2"
async-event = "0.2.1"
crossbeam-utils = "0.8"
diatomic-waker = "0.1"
futures-core = "0.3"
pin-project-lite = "0.2"

[target.'cfg(tachyonix_loom)'.dependencies]
loom = "0.5"

[dev-dependencies]
futures-executor = { version = "0.3", default-features = false, features = ["thread-pool"] }
futures-task = { version = "0.3", default-features = false, features = ["std"] }
futures-util = { version = "0.3", default-features = false, features = ["std", "async-await"] }
futures-time = "3.0"

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

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

[[test]]
name = "integration"
path = "tests/tests.rs"
6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -37,12 +37,6 @@
//! # std::thread::sleep(std::time::Duration::from_millis(100)); // MIRI bug workaround
//! ```
//!
// Temporary workaround until the `async_event_loom` flag can be whitelisted
// without a `build.rs` [1].
//
// [1]: (https://github.com/rust-lang/rust/issues/124800).
#![allow(unexpected_cfgs)]
#![warn(missing_docs, missing_debug_implementations, unreachable_pub)]

mod loom_exports;
12 changes: 6 additions & 6 deletions src/loom_exports.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(tachyonix_loom)]
#[cfg(all(test, tachyonix_loom))]
#[allow(unused_imports)]
pub(crate) mod sync {
pub(crate) use loom::sync::{Arc, Mutex};
@@ -7,7 +7,7 @@ pub(crate) mod sync {
pub(crate) use loom::sync::atomic::{AtomicBool, AtomicUsize};
}
}
#[cfg(not(tachyonix_loom))]
#[cfg(not(all(test, tachyonix_loom)))]
#[allow(unused_imports)]
pub(crate) mod sync {
pub(crate) use std::sync::{Arc, Mutex};
@@ -17,11 +17,11 @@ pub(crate) mod sync {
}
}

#[cfg(tachyonix_loom)]
#[cfg(all(test, tachyonix_loom))]
pub(crate) mod cell {
pub(crate) use loom::cell::UnsafeCell;
}
#[cfg(not(tachyonix_loom))]
#[cfg(not(all(test, tachyonix_loom)))]
pub(crate) mod cell {
#[derive(Debug)]
pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>);
@@ -45,11 +45,11 @@ pub(crate) mod cell {

#[allow(unused_macros)]
macro_rules! debug_or_loom_assert {
($($arg:tt)*) => (if cfg!(any(debug_assertions, tachyonix_loom)) { assert!($($arg)*); })
($($arg:tt)*) => (if cfg!(any(debug_assertions, all(test, tachyonix_loom))) { assert!($($arg)*); })
}
#[allow(unused_macros)]
macro_rules! debug_or_loom_assert_eq {
($($arg:tt)*) => (if cfg!(any(debug_assertions, tachyonix_loom)) { assert_eq!($($arg)*); })
($($arg:tt)*) => (if cfg!(any(debug_assertions, all(test, tachyonix_loom))) { assert_eq!($($arg)*); })
}
#[allow(unused_imports)]
pub(crate) use debug_or_loom_assert;

0 comments on commit 3c02450

Please sign in to comment.