Skip to content
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
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ jobs:
run: cargo check -Z features=dev_dep
- run: cargo test
- run: cargo test --no-default-features
- run: cargo test --features portable-atomic
- run: cargo test --no-default-features --features portable-atomic
- name: Install cargo-hack and wasm-pack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack,cargo-minimal-versions,wasm-pack
- run: rustup target add thumbv7m-none-eabi
- run: rustup target add thumbv6m-none-eabi thumbv7m-none-eabi
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
run: cargo hack build --all --no-dev-deps
- run: cargo hack build --all --target thumbv7m-none-eabi --no-default-features --no-dev-deps
run: cargo hack build --feature-powerset --no-dev-deps
- name: Run cargo check for no-std target with atomic CAS
run: cargo hack build --feature-powerset --no-dev-deps --target thumbv7m-none-eabi --skip std,default
- name: Run cargo check for no-std target without atomic CAS
run: cargo hack build --feature-powerset --no-dev-deps --target thumbv6m-none-eabi --skip std,default --features portable-atomic,portable-atomic/critical-section
- name: Run cargo check for WASM
run: cargo check --all --all-features --all-targets --target wasm32-unknown-unknown
- name: Test WASM
Expand All @@ -74,8 +79,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- run: cargo hack build --rust-version
- run: cargo hack build --no-default-features --rust-version
- run: cargo hack build --feature-powerset --no-dev-deps --rust-version

clippy:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ exclude = ["/.*"]

[dependencies]
concurrent-queue = { version = "2.5", default-features = false }
event-listener-strategy = { version = "0.5.2", default-features = false }
event-listener-strategy = { version = "0.5.4", default-features = false }
futures-core = { version = "0.3.5", default-features = false }
pin-project-lite = "0.2.11"

portable-atomic = { version = "1", default-features = false, features = ["require-cas"], optional = true }
portable-atomic-util = { version = "0.2", default-features = false, features = ["alloc"], optional = true }

[dev-dependencies]
easy-parallel = "3"
futures-lite = "2"
Expand All @@ -30,3 +33,4 @@ wasm-bindgen-test = "0.3.37"
[features]
default = ["std"]
std = ["concurrent-queue/std", "event-listener-strategy/std"]
portable-atomic = ["concurrent-queue/portable-atomic", "event-listener-strategy/portable-atomic", "dep:portable-atomic-util", "dep:portable-atomic"]
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,24 @@
html_logo_url = "https://raw.githubusercontent.com/smol-rs/smol/master/assets/images/logo_fullsize_transparent.png"
)]

#[cfg(not(feature = "portable-atomic"))]
extern crate alloc;

use core::fmt;
use core::future::Future;
use core::marker::PhantomPinned;
use core::pin::Pin;
use core::sync::atomic::{AtomicUsize, Ordering};
use core::task::{Context, Poll};

#[cfg(not(feature = "portable-atomic"))]
use alloc::sync::Arc;
#[cfg(not(feature = "portable-atomic"))]
use core::sync::atomic::{AtomicUsize, Ordering};

#[cfg(feature = "portable-atomic")]
use portable_atomic::{AtomicUsize, Ordering};
#[cfg(feature = "portable-atomic")]
use portable_atomic_util::Arc;

use concurrent_queue::{ConcurrentQueue, ForcePushError, PopError, PushError};
use event_listener_strategy::{
Expand Down