Skip to content

Commit 3f73ddd

Browse files
committed
Expose cfg(futures_no_atomic_cas) as unstable public API
1 parent 2b5d082 commit 3f73ddd

File tree

11 files changed

+87
-47
lines changed

11 files changed

+87
-47
lines changed

futures-channel/build.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ use std::env;
22

33
include!("no_atomic_cas.rs");
44

5-
// The rustc-cfg strings below are *not* public API. Please let us know by
6-
// opening a GitHub issue if your build environment requires some way to enable
7-
// these cfgs other than by executing our build script.
5+
// The rustc-cfg listed below are considered public API, but it is *unstable*
6+
// and outside of the normal semver guarantees:
7+
//
8+
// - `futures_no_atomic_cas`
9+
// Assume the target does not have atomic CAS (compare-and-swap).
10+
// This is usually detected automatically by the build script, but you may
11+
// need to enable it manually when building for custom targets or using
12+
// non-cargo build systems that don't run the build script.
13+
//
14+
// With the exceptions mentioned above, the rustc-cfg strings below are
15+
// *not* public API. Please let us know by opening a GitHub issue if your build
16+
// environment requires some way to enable these cfgs other than by executing
17+
// our build script.
818
fn main() {
919
let target = match env::var("TARGET") {
1020
Ok(target) => target,
@@ -18,12 +28,12 @@ fn main() {
1828
}
1929
};
2030

21-
// Note that this is `no_atomic_cas`, not `has_atomic_cas`. This allows
22-
// treating `cfg(target_has_atomic = "ptr")` as true when the build script
23-
// doesn't run. This is needed for compatibility with non-cargo build
24-
// systems that don't run build scripts.
31+
// Note that this is `no_*`, not `has_*`. This allows treating
32+
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
33+
// run. This is needed for compatibility with non-cargo build systems that
34+
// don't run the build script.
2535
if NO_ATOMIC_CAS_TARGETS.contains(&&*target) {
26-
println!("cargo:rustc-cfg=no_atomic_cas");
36+
println!("cargo:rustc-cfg=futures_no_atomic_cas");
2737
}
2838

2939
println!("cargo:rerun-if-changed=no_atomic_cas.rs");

futures-channel/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
macro_rules! cfg_target_has_atomic {
2222
($($item:item)*) => {$(
23-
#[cfg(not(no_atomic_cas))]
23+
#[cfg(not(futures_no_atomic_cas))]
2424
$item
2525
)*};
2626
}

futures-core/build.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ use std::env;
22

33
include!("no_atomic_cas.rs");
44

5-
// The rustc-cfg strings below are *not* public API. Please let us know by
6-
// opening a GitHub issue if your build environment requires some way to enable
7-
// these cfgs other than by executing our build script.
5+
// The rustc-cfg listed below are considered public API, but it is *unstable*
6+
// and outside of the normal semver guarantees:
7+
//
8+
// - `futures_no_atomic_cas`
9+
// Assume the target does not have atomic CAS (compare-and-swap).
10+
// This is usually detected automatically by the build script, but you may
11+
// need to enable it manually when building for custom targets or using
12+
// non-cargo build systems that don't run the build script.
13+
//
14+
// With the exceptions mentioned above, the rustc-cfg strings below are
15+
// *not* public API. Please let us know by opening a GitHub issue if your build
16+
// environment requires some way to enable these cfgs other than by executing
17+
// our build script.
818
fn main() {
919
let target = match env::var("TARGET") {
1020
Ok(target) => target,
@@ -18,12 +28,12 @@ fn main() {
1828
}
1929
};
2030

21-
// Note that this is `no_atomic_cas`, not `has_atomic_cas`. This allows
22-
// treating `cfg(target_has_atomic = "ptr")` as true when the build script
23-
// doesn't run. This is needed for compatibility with non-cargo build
24-
// systems that don't run build scripts.
31+
// Note that this is `no_*`, not `has_*`. This allows treating
32+
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
33+
// run. This is needed for compatibility with non-cargo build systems that
34+
// don't run the build script.
2535
if NO_ATOMIC_CAS_TARGETS.contains(&&*target) {
26-
println!("cargo:rustc-cfg=no_atomic_cas");
36+
println!("cargo:rustc-cfg=futures_no_atomic_cas");
2737
}
2838

2939
println!("cargo:rerun-if-changed=no_atomic_cas.rs");
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(not(no_atomic_cas))]
1+
#[cfg(not(futures_no_atomic_cas))]
22
mod atomic_waker;
3-
#[cfg(not(no_atomic_cas))]
3+
#[cfg(not(futures_no_atomic_cas))]
44
pub use self::atomic_waker::AtomicWaker;

futures-task/build.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ use std::env;
22

33
include!("no_atomic_cas.rs");
44

5-
// The rustc-cfg strings below are *not* public API. Please let us know by
6-
// opening a GitHub issue if your build environment requires some way to enable
7-
// these cfgs other than by executing our build script.
5+
// The rustc-cfg listed below are considered public API, but it is *unstable*
6+
// and outside of the normal semver guarantees:
7+
//
8+
// - `futures_no_atomic_cas`
9+
// Assume the target does not have atomic CAS (compare-and-swap).
10+
// This is usually detected automatically by the build script, but you may
11+
// need to enable it manually when building for custom targets or using
12+
// non-cargo build systems that don't run the build script.
13+
//
14+
// With the exceptions mentioned above, the rustc-cfg strings below are
15+
// *not* public API. Please let us know by opening a GitHub issue if your build
16+
// environment requires some way to enable these cfgs other than by executing
17+
// our build script.
818
fn main() {
919
let target = match env::var("TARGET") {
1020
Ok(target) => target,
@@ -18,12 +28,12 @@ fn main() {
1828
}
1929
};
2030

21-
// Note that this is `no_atomic_cas`, not `has_atomic_cas`. This allows
22-
// treating `cfg(target_has_atomic = "ptr")` as true when the build script
23-
// doesn't run. This is needed for compatibility with non-cargo build
24-
// systems that don't run build scripts.
31+
// Note that this is `no_*`, not `has_*`. This allows treating
32+
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
33+
// run. This is needed for compatibility with non-cargo build systems that
34+
// don't run the build script.
2535
if NO_ATOMIC_CAS_TARGETS.contains(&&*target) {
26-
println!("cargo:rustc-cfg=no_atomic_cas");
36+
println!("cargo:rustc-cfg=futures_no_atomic_cas");
2737
}
2838

2939
println!("cargo:rerun-if-changed=no_atomic_cas.rs");

futures-task/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern crate alloc;
1212

1313
macro_rules! cfg_target_has_atomic {
1414
($($item:item)*) => {$(
15-
#[cfg(not(no_atomic_cas))]
15+
#[cfg(not(futures_no_atomic_cas))]
1616
$item
1717
)*};
1818
}

futures-util/build.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ use std::env;
22

33
include!("no_atomic_cas.rs");
44

5-
// The rustc-cfg strings below are *not* public API. Please let us know by
6-
// opening a GitHub issue if your build environment requires some way to enable
7-
// these cfgs other than by executing our build script.
5+
// The rustc-cfg listed below are considered public API, but it is *unstable*
6+
// and outside of the normal semver guarantees:
7+
//
8+
// - `futures_no_atomic_cas`
9+
// Assume the target does not have atomic CAS (compare-and-swap).
10+
// This is usually detected automatically by the build script, but you may
11+
// need to enable it manually when building for custom targets or using
12+
// non-cargo build systems that don't run the build script.
13+
//
14+
// With the exceptions mentioned above, the rustc-cfg strings below are
15+
// *not* public API. Please let us know by opening a GitHub issue if your build
16+
// environment requires some way to enable these cfgs other than by executing
17+
// our build script.
818
fn main() {
919
let target = match env::var("TARGET") {
1020
Ok(target) => target,
@@ -18,12 +28,12 @@ fn main() {
1828
}
1929
};
2030

21-
// Note that this is `no_atomic_cas`, not `has_atomic_cas`. This allows
22-
// treating `cfg(target_has_atomic = "ptr")` as true when the build script
23-
// doesn't run. This is needed for compatibility with non-cargo build
24-
// systems that don't run build scripts.
31+
// Note that this is `no_*`, not `has_*`. This allows treating
32+
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
33+
// run. This is needed for compatibility with non-cargo build systems that
34+
// don't run the build script.
2535
if NO_ATOMIC_CAS_TARGETS.contains(&&*target) {
26-
println!("cargo:rustc-cfg=no_atomic_cas");
36+
println!("cargo:rustc-cfg=futures_no_atomic_cas");
2737
}
2838

2939
println!("cargo:rerun-if-changed=no_atomic_cas.rs");

futures-util/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub mod __private {
4949

5050
macro_rules! cfg_target_has_atomic {
5151
($($item:item)*) => {$(
52-
#[cfg(not(no_atomic_cas))]
52+
#[cfg(not(futures_no_atomic_cas))]
5353
$item
5454
)*};
5555
}

futures-util/src/stream/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ pub use self::stream::ReadyChunks;
3737
#[cfg_attr(docsrs, doc(cfg(feature = "sink")))]
3838
pub use self::stream::Forward;
3939

40-
#[cfg(not(no_atomic_cas))]
40+
#[cfg(not(futures_no_atomic_cas))]
4141
#[cfg(feature = "alloc")]
4242
pub use self::stream::{BufferUnordered, Buffered, ForEachConcurrent, TryForEachConcurrent};
4343

44-
#[cfg(not(no_atomic_cas))]
44+
#[cfg(not(futures_no_atomic_cas))]
4545
#[cfg(feature = "sink")]
4646
#[cfg_attr(docsrs, doc(cfg(feature = "sink")))]
4747
#[cfg(feature = "alloc")]
@@ -59,7 +59,7 @@ pub use self::try_stream::{
5959
#[cfg(feature = "std")]
6060
pub use self::try_stream::IntoAsyncRead;
6161

62-
#[cfg(not(no_atomic_cas))]
62+
#[cfg(not(futures_no_atomic_cas))]
6363
#[cfg(feature = "alloc")]
6464
pub use self::try_stream::{TryBufferUnordered, TryBuffered};
6565

futures-util/src/stream/stream/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ pub trait StreamExt: Stream {
933933
/// fut.await;
934934
/// # })
935935
/// ```
936-
#[cfg(not(no_atomic_cas))]
936+
#[cfg(not(futures_no_atomic_cas))]
937937
#[cfg(feature = "alloc")]
938938
fn for_each_concurrent<Fut, F>(
939939
self,
@@ -1066,7 +1066,7 @@ pub trait StreamExt: Stream {
10661066
/// assert_eq!(Err(oneshot::Canceled), fut.await);
10671067
/// # })
10681068
/// ```
1069-
#[cfg(not(no_atomic_cas))]
1069+
#[cfg(not(futures_no_atomic_cas))]
10701070
#[cfg(feature = "alloc")]
10711071
fn try_for_each_concurrent<Fut, F, E>(
10721072
self,
@@ -1293,7 +1293,7 @@ pub trait StreamExt: Stream {
12931293
/// # Panics
12941294
///
12951295
/// This method will panic if `n` is zero.
1296-
#[cfg(not(no_atomic_cas))]
1296+
#[cfg(not(futures_no_atomic_cas))]
12971297
#[cfg(feature = "alloc")]
12981298
fn buffered(self, n: usize) -> Buffered<Self>
12991299
where
@@ -1342,7 +1342,7 @@ pub trait StreamExt: Stream {
13421342
/// assert_eq!(buffered.next().await, None);
13431343
/// # Ok::<(), i32>(()) }).unwrap();
13441344
/// ```
1345-
#[cfg(not(no_atomic_cas))]
1345+
#[cfg(not(futures_no_atomic_cas))]
13461346
#[cfg(feature = "alloc")]
13471347
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
13481348
where
@@ -1509,7 +1509,7 @@ pub trait StreamExt: Stream {
15091509
/// library is activated, and it is activated by default.
15101510
#[cfg(feature = "sink")]
15111511
#[cfg_attr(docsrs, doc(cfg(feature = "sink")))]
1512-
#[cfg(not(no_atomic_cas))]
1512+
#[cfg(not(futures_no_atomic_cas))]
15131513
#[cfg(feature = "alloc")]
15141514
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
15151515
where

futures-util/src/stream/try_stream/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ pub trait TryStreamExt: TryStream {
684684
/// assert_eq!(buffered.next().await, Some(Err("error in the stream")));
685685
/// # Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
686686
/// ```
687-
#[cfg(not(no_atomic_cas))]
687+
#[cfg(not(futures_no_atomic_cas))]
688688
#[cfg(feature = "alloc")]
689689
fn try_buffer_unordered(self, n: usize) -> TryBufferUnordered<Self>
690690
where
@@ -760,7 +760,7 @@ pub trait TryStreamExt: TryStream {
760760
/// assert_eq!(buffered.next().await, Some(Err("error in the stream")));
761761
/// # Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
762762
/// ```
763-
#[cfg(not(no_atomic_cas))]
763+
#[cfg(not(futures_no_atomic_cas))]
764764
#[cfg(feature = "alloc")]
765765
fn try_buffered(self, n: usize) -> TryBuffered<Self>
766766
where

0 commit comments

Comments
 (0)