Skip to content

Commit

Permalink
Get building on thumbv6m targets
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nemo157 committed Jul 14, 2018
1 parent 1bdf33d commit aaee1fb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ matrix:
- cargo build --manifest-path futures-executor/Cargo.toml --no-default-features
- cargo build --manifest-path futures-sink/Cargo.toml --no-default-features
- cargo build --manifest-path futures-util/Cargo.toml --no-default-features
# - rust: nightly
# script:
# - rustup component add rust-src
# - cargo install xargo
# - xargo build --manifest-path futures/Cargo.toml --target thumbv6m-none-eabi --no-default-features
- rust: nightly
script:
- rustup target add thumbv6m-none-eabi
- cargo build --manifest-path futures/Cargo.toml --target thumbv6m-none-eabi --no-default-features --features nightly
# - rust: 1.20.0
# script: cargo test --all
# - rust: nightly
Expand Down
2 changes: 0 additions & 2 deletions futures-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

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

#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]

#[cfg(feature = "std")]
extern crate std;

Expand Down
1 change: 1 addition & 0 deletions futures-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! and the `AsyncRead` and `AsyncWrite` traits.
#![feature(async_await, await_macro, pin, arbitrary_self_types, futures_api)]
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(missing_docs, missing_debug_implementations, warnings)]
Expand Down
10 changes: 8 additions & 2 deletions futures-util/src/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
mod context;
pub use self::context::ContextExt;

#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
#[cfg_attr(
feature = "nightly",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
mod atomic_waker;
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
#[cfg_attr(
feature = "nightly",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
pub use self::atomic_waker::AtomicWaker;
5 changes: 4 additions & 1 deletion futures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ pub mod task {

pub use futures_util::task::ContextExt;

#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
#[cfg_attr(
feature = "nightly",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
pub use futures_util::task::AtomicWaker;

#[cfg(feature = "std")]
Expand Down

0 comments on commit aaee1fb

Please sign in to comment.