Skip to content

Commit aaee1fb

Browse files
committed
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 1bdf33d commit aaee1fb

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ matrix:
1616
- cargo build --manifest-path futures-executor/Cargo.toml --no-default-features
1717
- cargo build --manifest-path futures-sink/Cargo.toml --no-default-features
1818
- cargo build --manifest-path futures-util/Cargo.toml --no-default-features
19-
# - rust: nightly
20-
# script:
21-
# - rustup component add rust-src
22-
# - cargo install xargo
23-
# - xargo build --manifest-path futures/Cargo.toml --target thumbv6m-none-eabi --no-default-features
19+
- rust: nightly
20+
script:
21+
- rustup target add thumbv6m-none-eabi
22+
- cargo build --manifest-path futures/Cargo.toml --target thumbv6m-none-eabi --no-default-features --features nightly
2423
# - rust: 1.20.0
2524
# script: cargo test --all
2625
# - rust: nightly

futures-core/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
#![doc(html_root_url = "https://docs.rs/futures-core/0.3.0-alpha")]
1111

12-
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
13-
1412
#[cfg(feature = "std")]
1513
extern crate std;
1614

futures-util/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! and the `AsyncRead` and `AsyncWrite` traits.
33
44
#![feature(async_await, await_macro, pin, arbitrary_self_types, futures_api)]
5+
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
56

67
#![cfg_attr(not(feature = "std"), no_std)]
78
#![deny(missing_docs, missing_debug_implementations, warnings)]

futures-util/src/task/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
mod context;
44
pub use self::context::ContextExt;
55

6-
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
6+
#[cfg_attr(
7+
feature = "nightly",
8+
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
9+
)]
710
mod atomic_waker;
8-
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
11+
#[cfg_attr(
12+
feature = "nightly",
13+
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
14+
)]
915
pub use self::atomic_waker::AtomicWaker;

futures/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,10 @@ pub mod task {
339339

340340
pub use futures_util::task::ContextExt;
341341

342-
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
342+
#[cfg_attr(
343+
feature = "nightly",
344+
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
345+
)]
343346
pub use futures_util::task::AtomicWaker;
344347

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

0 commit comments

Comments
 (0)