Skip to content

Commit 7550663

Browse files
taiki-ecramertj
authored andcommitted
Fix breakage with cfg-target-has-atomic feature
1 parent 0fb518a commit 7550663

File tree

6 files changed

+17
-68
lines changed

6 files changed

+17
-68
lines changed

futures-channel/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ compile_error!("The `cfg-target-has-atomic` feature requires the `unstable` feat
2424

2525
macro_rules! cfg_target_has_atomic {
2626
($($item:item)*) => {$(
27-
#[cfg_attr(
28-
feature = "cfg-target-has-atomic",
29-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
30-
)]
27+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
3128
$item
3229
)*};
3330
}
+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
#[cfg_attr(
2-
feature = "cfg-target-has-atomic",
3-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
4-
)]
1+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
52
mod atomic_waker;
6-
#[cfg_attr(
7-
feature = "cfg-target-has-atomic",
8-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
9-
)]
3+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
104
pub use self::atomic_waker::AtomicWaker;

futures-util/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ pub use futures_core::core_reexport;
4848

4949
macro_rules! cfg_target_has_atomic {
5050
($($item:item)*) => {$(
51-
#[cfg_attr(
52-
feature = "cfg-target-has-atomic",
53-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
54-
)]
51+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
5552
$item
5653
)*};
5754
}

futures-util/src/stream/mod.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -685,10 +685,7 @@ pub trait StreamExt: Stream {
685685
/// fut.await;
686686
/// # })
687687
/// ```
688-
#[cfg_attr(
689-
feature = "cfg-target-has-atomic",
690-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
691-
)]
688+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
692689
#[cfg(feature = "alloc")]
693690
fn for_each_concurrent<Fut, F>(
694691
self,
@@ -904,10 +901,7 @@ pub trait StreamExt: Stream {
904901
///
905902
/// This method is only available when the `std` or `alloc` feature of this
906903
/// library is activated, and it is activated by default.
907-
#[cfg_attr(
908-
feature = "cfg-target-has-atomic",
909-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
910-
)]
904+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
911905
#[cfg(feature = "alloc")]
912906
fn buffered(self, n: usize) -> Buffered<Self>
913907
where Self::Item: Future,
@@ -951,10 +945,7 @@ pub trait StreamExt: Stream {
951945
/// assert_eq!(buffered.next().await, None);
952946
/// # Ok::<(), i32>(()) }).unwrap();
953947
/// ```
954-
#[cfg_attr(
955-
feature = "cfg-target-has-atomic",
956-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
957-
)]
948+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
958949
#[cfg(feature = "alloc")]
959950
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
960951
where Self::Item: Future,
@@ -1085,10 +1076,7 @@ pub trait StreamExt: Stream {
10851076
/// This method is only available when the `std` or `alloc` feature of this
10861077
/// library is activated, and it is activated by default.
10871078
#[cfg(feature = "sink")]
1088-
#[cfg_attr(
1089-
feature = "cfg-target-has-atomic",
1090-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
1091-
)]
1079+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
10921080
#[cfg(feature = "alloc")]
10931081
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
10941082
where Self: Sink<Item> + Sized

futures-util/src/try_stream/mod.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,7 @@ pub trait TryStreamExt: TryStream {
420420
/// assert_eq!(Err(oneshot::Canceled), fut.await);
421421
/// # })
422422
/// ```
423-
#[cfg_attr(
424-
feature = "cfg-target-has-atomic",
425-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
426-
)]
423+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
427424
#[cfg(feature = "alloc")]
428425
fn try_for_each_concurrent<Fut, F>(
429426
self,
@@ -732,10 +729,7 @@ pub trait TryStreamExt: TryStream {
732729
/// assert_eq!(buffered.next().await, Some(Err("error in the stream")));
733730
/// # Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
734731
/// ```
735-
#[cfg_attr(
736-
feature = "cfg-target-has-atomic",
737-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
738-
)]
732+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
739733
#[cfg(feature = "alloc")]
740734
fn try_buffer_unordered(self, n: usize) -> TryBufferUnordered<Self>
741735
where Self::Ok: TryFuture<Error = Self::Error>,

futures/src/lib.rs

+7-28
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ pub use futures_util::pin_mut;
7575
#[cfg(feature = "async-await")]
7676
pub use futures_util::{pending, poll}; // Async-await
7777

78-
#[cfg_attr(
79-
feature = "cfg-target-has-atomic",
80-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
81-
)]
78+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
8279
#[cfg(feature = "alloc")]
8380
pub mod channel {
8481
//! Cross-task communication.
@@ -243,10 +240,7 @@ pub mod future {
243240
select_all, SelectAll,
244241
};
245242

246-
#[cfg_attr(
247-
feature = "cfg-target-has-atomic",
248-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
249-
)]
243+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
250244
#[cfg(feature = "alloc")]
251245
pub use futures_util::future::{
252246
abortable, Abortable, AbortHandle, AbortRegistration, Aborted,
@@ -319,10 +313,7 @@ pub mod io {
319313
};
320314
}
321315

322-
#[cfg_attr(
323-
feature = "cfg-target-has-atomic",
324-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
325-
)]
316+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
326317
#[cfg(feature = "alloc")]
327318
pub mod lock {
328319
//! Futures-powered synchronization primitives.
@@ -438,10 +429,7 @@ pub mod stream {
438429
Chunks,
439430
};
440431

441-
#[cfg_attr(
442-
feature = "cfg-target-has-atomic",
443-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
444-
)]
432+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
445433
#[cfg(feature = "alloc")]
446434
pub use futures_util::stream::{
447435
FuturesOrdered,
@@ -469,10 +457,7 @@ pub mod stream {
469457
IntoStream,
470458
};
471459

472-
#[cfg_attr(
473-
feature = "cfg-target-has-atomic",
474-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
475-
)]
460+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
476461
#[cfg(feature = "alloc")]
477462
pub use futures_util::try_stream::{
478463
// For TryStreamExt:
@@ -509,17 +494,11 @@ pub mod task {
509494
#[cfg(feature = "alloc")]
510495
pub use futures_util::task::{SpawnExt, LocalSpawnExt};
511496

512-
#[cfg_attr(
513-
feature = "cfg-target-has-atomic",
514-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
515-
)]
497+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
516498
#[cfg(feature = "alloc")]
517499
pub use futures_util::task::{waker, waker_ref, WakerRef, ArcWake};
518500

519-
#[cfg_attr(
520-
feature = "cfg-target-has-atomic",
521-
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
522-
)]
501+
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
523502
pub use futures_util::task::AtomicWaker;
524503
}
525504

0 commit comments

Comments
 (0)