Skip to content

Separate cfg-target-has-atomic feature #1442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2019
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
1 change: 1 addition & 0 deletions futures-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ name = "futures_core"
default = ["std"]
std = ["either/use_std"]
nightly = []
cfg-target-has-atomic = []

[dependencies]
either = { version = "1.4", default-features = false, optional = true }
Expand Down
5 changes: 4 additions & 1 deletion futures-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Core traits and types for asynchronous operations in Rust.

#![feature(futures_api)]
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
#![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))]

#![cfg_attr(not(feature = "std"), no_std)]

Expand All @@ -10,6 +10,9 @@

#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.12/futures_core")]

#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "nightly")))]
compile_error!("The `cfg-target-has-atomic` feature requires the `nightly` feature as an explicit opt-in to unstable features");

pub mod future;
#[doc(hidden)] pub use self::future::{Future, FusedFuture, TryFuture};

Expand Down
4 changes: 2 additions & 2 deletions futures-core/src/task/__internal/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#[cfg_attr(
feature = "nightly",
feature = "cfg-target-has-atomic",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
mod atomic_waker;
#[cfg_attr(
feature = "nightly",
feature = "cfg-target-has-atomic",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
pub use self::atomic_waker::AtomicWaker;
1 change: 1 addition & 0 deletions futures-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ compat = ["std", "futures_01"]
io-compat = ["compat", "tokio-io"]
bench = []
nightly = []
cfg-target-has-atomic = []

[dependencies]
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.12", default-features = false }
Expand Down
5 changes: 4 additions & 1 deletion futures-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@

#![feature(futures_api, box_into_pin)]
#![cfg_attr(feature = "std", feature(async_await, await_macro))]
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
#![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))]

#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs, missing_debug_implementations)]
#![deny(bare_trait_objects)]

#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.12/futures_util")]

#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "nightly")))]
compile_error!("The `cfg-target-has-atomic` feature requires the `nightly` feature as an explicit opt-in to unstable features");

#[macro_use]
mod macros;

Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod local_waker_ref;
pub use self::local_waker_ref::{local_waker_ref, local_waker_ref_from_nonlocal, LocalWakerRef};

#[cfg_attr(
feature = "nightly",
feature = "cfg-target-has-atomic",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
pub use futures_core::task::__internal::AtomicWaker;
Expand Down
1 change: 1 addition & 0 deletions futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ std = ["futures-core-preview/std", "futures-executor-preview/std", "futures-io-p
default = ["std"]
compat = ["std", "futures-util-preview/compat"]
io-compat = ["compat", "futures-util-preview/io-compat"]
cfg-target-has-atomic = ["futures-core-preview/cfg-target-has-atomic", "futures-util-preview/cfg-target-has-atomic"]
6 changes: 4 additions & 2 deletions futures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//! completion, but *do not block* the thread running them.

#![feature(futures_api)]
#![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))]

#![cfg_attr(not(feature = "std"), no_std)]

Expand All @@ -30,7 +31,8 @@

#![doc(html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.12/futures")]

#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "nightly")))]
compile_error!("The `cfg-target-has-atomic` feature requires the `nightly` feature as an explicit opt-in to unstable features");

#[doc(hidden)] pub use futures_util::core_reexport;

Expand Down Expand Up @@ -379,7 +381,7 @@ pub mod task {
};

#[cfg_attr(
feature = "nightly",
feature = "target-has-atomic",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
pub use futures_util::task::AtomicWaker;
Expand Down