Skip to content

Commit 1f645dd

Browse files
Nemo157sdroege
authored andcommitted
Get building on thumbv6m targets
As of rust-lang/rust#51953 `cfg(target_has_atomic)` has been updated to separately enable compare-and-swap (CAS) operations from the different supported sizes. Because `AtomicWaker` uses these CAS operations we need to also gate its inclusion on `cfg(target_has_atomic = "cas")`. `thumv6m` is one of the architectures that supports atomic read-write operations on its pointer sized integers, but doesn't support CAS operations.
1 parent 1510acc commit 1f645dd

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ matrix:
2727
- cargo test --manifest-path futures/Cargo.toml --features nightly --test async_await_tests
2828
- rust: nightly
2929
script:
30-
- rustup component add rust-src
31-
- cargo install xargo
32-
- xargo build --manifest-path futures/Cargo.toml --target thumbv6m-none-eabi --no-default-features --features nightly
30+
- rustup target add thumbv6m-none-eabi
31+
- cargo build --manifest-path futures/Cargo.toml --target thumbv6m-none-eabi --no-default-features --features nightly
3332
- rust: 1.20.0
3433
script: cargo test --all
3534
- rust: nightly

futures-core/src/task/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ mod data {
2525
}
2626

2727

28-
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
28+
#[cfg_attr(
29+
feature = "nightly",
30+
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
31+
)]
2932
mod atomic_waker;
30-
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
33+
#[cfg_attr(
34+
feature = "nightly",
35+
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
36+
)]
3137
pub use self::atomic_waker::AtomicWaker;
3238

3339
/// A map storing task-local data.

futures/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#![no_std]
2323
#![doc(html_root_url = "https://docs.rs/futures/0.2.2")]
2424

25-
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
2625
#![cfg_attr(feature = "nightly", feature(use_extern_macros))]
26+
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
2727

2828
extern crate futures_async_runtime;
2929
extern crate futures_core;
@@ -392,7 +392,10 @@ pub mod task {
392392
Context, LocalMap, Waker, UnsafeWake,
393393
};
394394

395-
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
395+
#[cfg_attr(
396+
feature = "nightly",
397+
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
398+
)]
396399
pub use futures_core::task::AtomicWaker;
397400

398401
#[cfg(feature = "std")]

0 commit comments

Comments
 (0)