-
Notifications
You must be signed in to change notification settings - Fork 636
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
Remove uses of unstable feature(cfg_target_has_atomic) #2400
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
cd "$(cd "$(dirname "$0")" && pwd)"/.. | ||
|
||
file="no_atomic_cas.rs" | ||
|
||
{ | ||
echo "// This file is @generated by $(basename "$0")." | ||
echo "// It is not intended for manual editing." | ||
echo "" | ||
echo "const NO_ATOMIC_CAS_TARGETS: &[&str] = &[" | ||
} >"$file" | ||
|
||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"atomic-cas\" == false)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
done | ||
|
||
echo "];" >>"$file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#![warn(rust_2018_idioms, single_use_lifetimes)] | ||
|
||
use std::env; | ||
|
||
include!("no_atomic_cas.rs"); | ||
|
||
// The rustc-cfg listed below are considered public API, but it is *unstable* | ||
// and outside of the normal semver guarantees: | ||
// | ||
// - `futures_no_atomic_cas` | ||
// Assume the target does not have atomic CAS (compare-and-swap). | ||
// This is usually detected automatically by the build script, but you may | ||
// need to enable it manually when building for custom targets or using | ||
// non-cargo build systems that don't run the build script. | ||
// | ||
// With the exceptions mentioned above, the rustc-cfg strings below are | ||
// *not* public API. Please let us know by opening a GitHub issue if your build | ||
// environment requires some way to enable these cfgs other than by executing | ||
// our build script. | ||
fn main() { | ||
let target = match env::var("TARGET") { | ||
Ok(target) => target, | ||
Err(e) => { | ||
println!( | ||
"cargo:warning={}: unable to get TARGET environment variable: {}", | ||
env!("CARGO_PKG_NAME"), | ||
e | ||
); | ||
return; | ||
} | ||
}; | ||
|
||
// Note that this is `no_*`, not `has_*`. This allows treating | ||
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't | ||
// run. This is needed for compatibility with non-cargo build systems that | ||
// don't run the build script. | ||
if NO_ATOMIC_CAS_TARGETS.contains(&&*target) { | ||
println!("cargo:rustc-cfg=futures_no_atomic_cas"); | ||
} | ||
|
||
println!("cargo:rerun-if-changed=no_atomic_cas.rs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../no_atomic_cas.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#![warn(rust_2018_idioms, single_use_lifetimes)] | ||
|
||
use std::env; | ||
|
||
include!("no_atomic_cas.rs"); | ||
|
||
// The rustc-cfg listed below are considered public API, but it is *unstable* | ||
// and outside of the normal semver guarantees: | ||
// | ||
// - `futures_no_atomic_cas` | ||
// Assume the target does not have atomic CAS (compare-and-swap). | ||
// This is usually detected automatically by the build script, but you may | ||
// need to enable it manually when building for custom targets or using | ||
// non-cargo build systems that don't run the build script. | ||
// | ||
// With the exceptions mentioned above, the rustc-cfg strings below are | ||
// *not* public API. Please let us know by opening a GitHub issue if your build | ||
// environment requires some way to enable these cfgs other than by executing | ||
// our build script. | ||
fn main() { | ||
let target = match env::var("TARGET") { | ||
Ok(target) => target, | ||
Err(e) => { | ||
println!( | ||
"cargo:warning={}: unable to get TARGET environment variable: {}", | ||
env!("CARGO_PKG_NAME"), | ||
e | ||
); | ||
return; | ||
} | ||
}; | ||
|
||
// Note that this is `no_*`, not `has_*`. This allows treating | ||
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't | ||
// run. This is needed for compatibility with non-cargo build systems that | ||
// don't run the build script. | ||
if NO_ATOMIC_CAS_TARGETS.contains(&&*target) { | ||
println!("cargo:rustc-cfg=futures_no_atomic_cas"); | ||
} | ||
|
||
println!("cargo:rerun-if-changed=no_atomic_cas.rs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../no_atomic_cas.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))] | ||
#[cfg(not(futures_no_atomic_cas))] | ||
mod atomic_waker; | ||
#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))] | ||
#[cfg(not(futures_no_atomic_cas))] | ||
pub use self::atomic_waker::AtomicWaker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#![warn(rust_2018_idioms, single_use_lifetimes)] | ||
|
||
use std::env; | ||
|
||
include!("no_atomic_cas.rs"); | ||
|
||
// The rustc-cfg listed below are considered public API, but it is *unstable* | ||
// and outside of the normal semver guarantees: | ||
// | ||
// - `futures_no_atomic_cas` | ||
// Assume the target does not have atomic CAS (compare-and-swap). | ||
// This is usually detected automatically by the build script, but you may | ||
// need to enable it manually when building for custom targets or using | ||
// non-cargo build systems that don't run the build script. | ||
// | ||
// With the exceptions mentioned above, the rustc-cfg strings below are | ||
// *not* public API. Please let us know by opening a GitHub issue if your build | ||
// environment requires some way to enable these cfgs other than by executing | ||
// our build script. | ||
fn main() { | ||
let target = match env::var("TARGET") { | ||
Ok(target) => target, | ||
Err(e) => { | ||
println!( | ||
"cargo:warning={}: unable to get TARGET environment variable: {}", | ||
env!("CARGO_PKG_NAME"), | ||
e | ||
); | ||
return; | ||
} | ||
}; | ||
|
||
// Note that this is `no_*`, not `has_*`. This allows treating | ||
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't | ||
// run. This is needed for compatibility with non-cargo build systems that | ||
// don't run the build script. | ||
if NO_ATOMIC_CAS_TARGETS.contains(&&*target) { | ||
println!("cargo:rustc-cfg=futures_no_atomic_cas"); | ||
} | ||
|
||
println!("cargo:rerun-if-changed=no_atomic_cas.rs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../no_atomic_cas.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said in #2400 (comment), exposes cfg(futures_no_atomic_cas) as unstable public API (outside of the normal semver guarantees).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we probably need to set
#![cfg_attr(docsrs, doc(cfg_hide(futures_no_atomic_cas)))]
when rust-lang/rust#79341 merged...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be a while 😅