From 292fbdc9c02c0434fccd56275c92c1c54434d0de Mon Sep 17 00:00:00 2001 From: Jeff Vander Stoep Date: Thu, 1 Feb 2024 14:56:51 +0100 Subject: Upgrade futures-core to 0.3.30 This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/rust/crates/futures-core For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Test: TreeHugger Change-Id: I04882e8ad894b2b4056c70ba976419dc7eb47a6f --- .cargo_vcs_info.json | 2 +- Android.bp | 2 +- Cargo.toml | 5 +++-- Cargo.toml.orig | 4 ++-- METADATA | 23 +++++++++------------ build.rs | 41 ------------------------------------- no_atomic_cas.rs | 17 --------------- src/task/__internal/atomic_waker.rs | 7 ++++++- src/task/__internal/mod.rs | 7 +++++-- 9 files changed, 28 insertions(+), 80 deletions(-) delete mode 100644 build.rs delete mode 100644 no_atomic_cas.rs diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 2de4b01..54e0f09 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "5e3693a350f96244151081d2c030208cd15f9572" + "sha1": "de1a0fd64a1bcae9a1534ed4da1699632993cc26" }, "path_in_vcs": "futures-core" } \ No newline at end of file diff --git a/Android.bp b/Android.bp index e5a5cf3..312e347 100644 --- a/Android.bp +++ b/Android.bp @@ -42,7 +42,7 @@ rust_library { host_supported: true, crate_name: "futures_core", cargo_env_compat: true, - cargo_pkg_version: "0.3.26", + cargo_pkg_version: "0.3.30", srcs: ["src/lib.rs"], edition: "2018", features: [ diff --git a/Cargo.toml b/Cargo.toml index 62fb265..a97c11a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" rust-version = "1.36" name = "futures-core" -version = "0.3.26" +version = "0.3.30" description = """ The core traits and types in for the `futures` library. """ @@ -30,7 +30,8 @@ rustdoc-args = [ ] [dependencies.portable-atomic] -version = "1" +version = "1.3" +features = ["require-cas"] optional = true default-features = false diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 5b78edc..0e27db0 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "futures-core" -version = "0.3.26" +version = "0.3.30" edition = "2018" rust-version = "1.36" license = "MIT OR Apache-2.0" @@ -21,7 +21,7 @@ unstable = [] cfg-target-has-atomic = [] [dependencies] -portable-atomic = { version = "1", default-features = false, optional = true } +portable-atomic = { version = "1.3", optional = true, default-features = false, features = ["require-cas"] } [dev-dependencies] futures = { path = "../futures" } diff --git a/METADATA b/METADATA index 08f69f6..cda5f1f 100644 --- a/METADATA +++ b/METADATA @@ -1,23 +1,20 @@ # This project was upgraded with external_updater. -# Usage: tools/external_updater/updater.sh update rust/crates/futures-core -# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md +# Usage: tools/external_updater/updater.sh update external/rust/crates/futures-core +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md name: "futures-core" description: "The core traits and types in for the `futures` library." third_party { - url { - type: HOMEPAGE - value: "https://crates.io/crates/futures-core" - } - url { - type: ARCHIVE - value: "https://static.crates.io/crates/futures-core/futures-core-0.3.26.crate" - } - version: "0.3.26" license_type: NOTICE last_upgrade_date { - year: 2023 + year: 2024 month: 2 - day: 15 + day: 1 + } + homepage: "https://crates.io/crates/futures-core" + identifier { + type: "Archive" + value: "https://static.crates.io/crates/futures-core/futures-core-0.3.30.crate" + version: "0.3.30" } } diff --git a/build.rs b/build.rs deleted file mode 100644 index 05e0496..0000000 --- a/build.rs +++ /dev/null @@ -1,41 +0,0 @@ -// 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* support atomic CAS operations. -// 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 emitted by the build -// script are *not* public API. - -#![warn(rust_2018_idioms, single_use_lifetimes)] - -use std::env; - -include!("no_atomic_cas.rs"); - -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.contains(&&*target) { - println!("cargo:rustc-cfg=futures_no_atomic_cas"); - } - - println!("cargo:rerun-if-changed=no_atomic_cas.rs"); -} diff --git a/no_atomic_cas.rs b/no_atomic_cas.rs deleted file mode 100644 index 16ec628..0000000 --- a/no_atomic_cas.rs +++ /dev/null @@ -1,17 +0,0 @@ -// This file is @generated by no_atomic_cas.sh. -// It is not intended for manual editing. - -const NO_ATOMIC_CAS: &[&str] = &[ - "armv4t-none-eabi", - "armv5te-none-eabi", - "avr-unknown-gnu-atmega328", - "bpfeb-unknown-none", - "bpfel-unknown-none", - "msp430-none-elf", - "riscv32i-unknown-none-elf", - "riscv32im-unknown-none-elf", - "riscv32imc-unknown-none-elf", - "thumbv4t-none-eabi", - "thumbv5te-none-eabi", - "thumbv6m-none-eabi", -]; diff --git a/src/task/__internal/atomic_waker.rs b/src/task/__internal/atomic_waker.rs index 0677e83..2fc594b 100644 --- a/src/task/__internal/atomic_waker.rs +++ b/src/task/__internal/atomic_waker.rs @@ -271,7 +271,12 @@ impl AtomicWaker { WAITING => { unsafe { // Locked acquired, update the waker cell - *self.waker.get() = Some(waker.clone()); + + // Avoid cloning the waker if the old waker will awaken the same task. + match &*self.waker.get() { + Some(old_waker) if old_waker.will_wake(waker) => (), + _ => *self.waker.get() = Some(waker.clone()), + } // Release the lock. If the state transitioned to include // the `WAKING` bit, this means that at least one wake has diff --git a/src/task/__internal/mod.rs b/src/task/__internal/mod.rs index c902eb4..c248742 100644 --- a/src/task/__internal/mod.rs +++ b/src/task/__internal/mod.rs @@ -1,4 +1,7 @@ -#[cfg(not(futures_no_atomic_cas))] +#[cfg_attr(target_os = "none", cfg(any(target_has_atomic = "ptr", feature = "portable-atomic")))] mod atomic_waker; -#[cfg(not(futures_no_atomic_cas))] +#[cfg_attr( + target_os = "none", + cfg(any(target_has_atomic = "ptr", feature = "portable-atomic")) +)] pub use self::atomic_waker::AtomicWaker; -- cgit v1.2.3