diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-15 21:43:59 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-15 21:43:59 +0000 |
commit | 516429615e44680ad1e846a719b4740297b1c6c5 (patch) | |
tree | 009346ac01f7914f428f99d99c7fb1843062c111 | |
parent | 08339c7fb17176e4dca77d83e0d7f89a8997aa81 (diff) | |
parent | 777878a84fcf09d1a133a5d88fa304adb2253d0d (diff) | |
download | futures-core-android12-mainline-tzdata3-release.tar.gz |
Snap for 8730993 from 777878a84fcf09d1a133a5d88fa304adb2253d0d to mainline-tzdata3-releaseaml_tz3_314012070aml_tz3_314012050aml_tz3_314012010aml_tz3_313110000aml_tz3_312511020aml_tz3_312511010aml_tz3_312410020aml_tz3_312410010android12-mainline-tzdata3-releaseaml_tz3_314012010
Change-Id: Ibdd1f7d0f111ebffe682c56925e83e1f49c47d37
-rw-r--r-- | .cargo_vcs_info.json | 7 | ||||
-rw-r--r-- | Android.bp | 30 | ||||
-rw-r--r-- | Cargo.toml | 24 | ||||
-rw-r--r-- | Cargo.toml.orig | 10 | ||||
-rw-r--r-- | METADATA | 8 | ||||
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | TEST_MAPPING | 52 | ||||
-rw-r--r-- | build.rs | 41 | ||||
-rw-r--r-- | cargo2android.json | 5 | ||||
-rw-r--r-- | no_atomic_cas.rs | 13 | ||||
-rw-r--r-- | src/future.rs | 10 | ||||
-rw-r--r-- | src/lib.rs | 29 | ||||
-rw-r--r-- | src/stream.rs | 43 | ||||
-rw-r--r-- | src/task/__internal/atomic_waker.rs | 19 | ||||
-rw-r--r-- | src/task/__internal/mod.rs | 4 | ||||
-rw-r--r-- | src/task/mod.rs | 2 | ||||
-rw-r--r-- | src/task/poll.rs | 11 |
17 files changed, 156 insertions, 175 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 724f674..f3ad3ab 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,5 @@ { "git": { - "sha1": "fc1e3250219170e31cddb8857a276cba7dd08d44" - }, - "path_in_vcs": "futures-core" -}
\ No newline at end of file + "sha1": "c91f8691672c7401b1923ab00bf138975c99391a" + } +} @@ -37,12 +37,37 @@ license { ], } +rust_defaults { + name: "futures-core_defaults", + crate_name: "futures_core", + srcs: ["src/lib.rs"], + test_suites: ["general-tests"], + auto_gen_config: true, + edition: "2018", + features: [ + "alloc", + "default", + "std", + ], +} + +rust_test_host { + name: "futures-core_host_test_src_lib", + defaults: ["futures-core_defaults"], + test_options: { + unit_test: true, + }, +} + +rust_test { + name: "futures-core_device_test_src_lib", + defaults: ["futures-core_defaults"], +} + rust_library { name: "libfutures_core", host_supported: true, crate_name: "futures_core", - cargo_env_compat: true, - cargo_pkg_version: "0.3.21", srcs: ["src/lib.rs"], edition: "2018", features: [ @@ -52,7 +77,6 @@ rust_library { ], apex_available: [ "//apex_available:platform", - "com.android.bluetooth", "com.android.resolv", "com.android.virt", ], @@ -3,30 +3,26 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies. +# to registry (e.g., crates.io) dependencies # -# If you are reading this file be aware that the original Cargo.toml -# will likely look very different (and much more reasonable). -# See Cargo.toml.orig for the original contents. +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) [package] edition = "2018" -rust-version = "1.36" name = "futures-core" -version = "0.3.21" -description = """ -The core traits and types in for the `futures` library. -""" +version = "0.3.13" +authors = ["Alex Crichton <alex@alexcrichton.com>"] +description = "The core traits and types in for the `futures` library.\n" homepage = "https://rust-lang.github.io/futures-rs" +documentation = "https://docs.rs/futures-core/0.3" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/futures-rs" - [package.metadata.docs.rs] all-features = true -rustdoc-args = [ - "--cfg", - "docsrs", -] +rustdoc-args = ["--cfg", "docsrs"] [dependencies] diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 4a360f8..55601db 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,11 +1,12 @@ [package] name = "futures-core" -version = "0.3.21" edition = "2018" -rust-version = "1.36" +version = "0.3.13" +authors = ["Alex Crichton <alex@alexcrichton.com>"] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/futures-rs" homepage = "https://rust-lang.github.io/futures-rs" +documentation = "https://docs.rs/futures-core/0.3" description = """ The core traits and types in for the `futures` library. """ @@ -15,8 +16,9 @@ default = ["std"] std = ["alloc"] alloc = [] -# These features are no longer used. -# TODO: remove in the next major version. +# Unstable features +# These features are outside of the normal semver guarantees and require the +# `unstable` feature as an explicit opt-in to unstable API. unstable = [] cfg-target-has-atomic = [] @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/futures-core/futures-core-0.3.21.crate" + value: "https://static.crates.io/crates/futures-core/futures-core-0.3.13.crate" } - version: "0.3.21" + version: "0.3.13" license_type: NOTICE last_upgrade_date { - year: 2022 + year: 2021 month: 3 - day: 1 + day: 4 } } diff --git a/README.md b/README.md deleted file mode 100644 index 96e0e06..0000000 --- a/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# futures-core - -The core traits and types in for the `futures` library. - -## Usage - -Add this to your `Cargo.toml`: - -```toml -[dependencies] -futures-core = "0.3" -``` - -The current `futures-core` requires Rust 1.36 or later. - -## License - -Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or -[MIT license](LICENSE-MIT) at your option. - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in the work by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. diff --git a/TEST_MAPPING b/TEST_MAPPING index 5ef61de..8052406 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -1,45 +1,59 @@ // Generated by update_crate_tests.py for tests that depend on this crate. { - "imports": [ + "presubmit": [ { - "path": "external/rust/crates/anyhow" + "name": "anyhow_device_test_tests_test_repr" }, { - "path": "external/rust/crates/futures-util" + "name": "anyhow_device_test_tests_test_convert" }, { - "path": "external/rust/crates/tokio" + "name": "anyhow_device_test_src_lib" }, { - "path": "external/rust/crates/tokio-test" - } - ], - "presubmit": [ + "name": "anyhow_device_test_tests_test_chain" + }, { - "name": "ZipFuseTest" + "name": "anyhow_device_test_tests_test_boxed" }, { - "name": "authfs_device_test_src_lib" + "name": "tokio-test_device_test_tests_macros" }, { - "name": "doh_unit_test" + "name": "tokio-test_device_test_tests_block_on" }, { - "name": "virtualizationservice_device_test" - } - ], - "presubmit-rust": [ + "name": "anyhow_device_test_tests_test_downcast" + }, + { + "name": "anyhow_device_test_tests_test_context" + }, + { + "name": "futures-core_device_test_src_lib" + }, + { + "name": "futures-util_device_test_src_lib" + }, + { + "name": "tokio-test_device_test_tests_io" + }, + { + "name": "tokio-test_device_test_src_lib" + }, + { + "name": "anyhow_device_test_tests_test_macros" + }, { - "name": "ZipFuseTest" + "name": "anyhow_device_test_tests_test_ffi" }, { - "name": "authfs_device_test_src_lib" + "name": "anyhow_device_test_tests_test_fmt" }, { - "name": "doh_unit_test" + "name": "anyhow_device_test_tests_test_autotrait" }, { - "name": "virtualizationservice_device_test" + "name": "anyhow_device_test_tests_test_source" } ] } 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/cargo2android.json b/cargo2android.json index 5b266a6..44e747c 100644 --- a/cargo2android.json +++ b/cargo2android.json @@ -1,13 +1,12 @@ { "apex-available": [ "//apex_available:platform", - "com.android.bluetooth", "com.android.resolv", "com.android.virt" ], + "min_sdk_version": "29", "dependencies": true, "device": true, - "min-sdk-version": "29", "run": true, "tests": true -} +}
\ No newline at end of file diff --git a/no_atomic_cas.rs b/no_atomic_cas.rs deleted file mode 100644 index 9b05d4b..0000000 --- a/no_atomic_cas.rs +++ /dev/null @@ -1,13 +0,0 @@ -// This file is @generated by no_atomic_cas.sh. -// It is not intended for manual editing. - -const NO_ATOMIC_CAS: &[&str] = &[ - "avr-unknown-gnu-atmega328", - "bpfeb-unknown-none", - "bpfel-unknown-none", - "msp430-none-elf", - "riscv32i-unknown-none-elf", - "riscv32imc-unknown-none-elf", - "thumbv4t-none-eabi", - "thumbv6m-none-eabi", -]; diff --git a/src/future.rs b/src/future.rs index 7540cd0..d9327c0 100644 --- a/src/future.rs +++ b/src/future.rs @@ -67,12 +67,14 @@ pub trait TryFuture: Future + private_try_future::Sealed { /// This method is a stopgap for a compiler limitation that prevents us from /// directly inheriting from the `Future` trait; in the future it won't be /// needed. - fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<Self::Ok, Self::Error>>; + fn try_poll( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll<Result<Self::Ok, Self::Error>>; } impl<F, T, E> TryFuture for F -where - F: ?Sized + Future<Output = Result<T, E>>, + where F: ?Sized + Future<Output = Result<T, E>> { type Ok = T; type Error = E; @@ -85,8 +87,8 @@ where #[cfg(feature = "alloc")] mod if_alloc { - use super::*; use alloc::boxed::Box; + use super::*; impl<F: FusedFuture + ?Sized + Unpin> FusedFuture for Box<F> { fn is_terminated(&self) -> bool { @@ -1,27 +1,32 @@ //! Core traits and types for asynchronous operations in Rust. +#![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))] + #![cfg_attr(not(feature = "std"), no_std)] -#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub)] + +#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)] // It cannot be included in the published code because this lints have false positives in the minimum required version. #![cfg_attr(test, warn(single_use_lifetimes))] -#![doc(test( - no_crate_inject, - attr( - deny(warnings, rust_2018_idioms, single_use_lifetimes), - allow(dead_code, unused_assignments, unused_variables) - ) -))] +#![warn(clippy::all)] +#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))] + +#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "unstable")))] +compile_error!("The `cfg-target-has-atomic` feature requires the `unstable` feature as an explicit opt-in to unstable features"); #[cfg(feature = "alloc")] extern crate alloc; pub mod future; -#[doc(no_inline)] -pub use self::future::{FusedFuture, Future, TryFuture}; +#[doc(hidden)] pub use self::future::{Future, FusedFuture, TryFuture}; pub mod stream; -#[doc(no_inline)] -pub use self::stream::{FusedStream, Stream, TryStream}; +#[doc(hidden)] pub use self::stream::{Stream, FusedStream, TryStream}; #[macro_use] pub mod task; + +// Not public API. +#[doc(hidden)] +pub mod __private { + pub use core::task::Poll; +} diff --git a/src/stream.rs b/src/stream.rs index ad5350b..4a13e3b 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -63,7 +63,10 @@ pub trait Stream { /// calls. /// /// [`fuse`]: https://docs.rs/futures/0.3/futures/stream/trait.StreamExt.html#method.fuse - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>; + fn poll_next( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll<Option<Self::Item>>; /// Returns the bounds on the remaining length of the stream. /// @@ -100,7 +103,10 @@ pub trait Stream { impl<S: ?Sized + Stream + Unpin> Stream for &mut S { type Item = S::Item; - fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { + fn poll_next( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll<Option<Self::Item>> { S::poll_next(Pin::new(&mut **self), cx) } @@ -116,7 +122,10 @@ where { type Item = <P::Target as Stream>::Item; - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { + fn poll_next( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll<Option<Self::Item>> { self.get_mut().as_mut().poll_next(cx) } @@ -176,36 +185,35 @@ pub trait TryStream: Stream + private_try_stream::Sealed { /// This method is a stopgap for a compiler limitation that prevents us from /// directly inheriting from the `Stream` trait; in the future it won't be /// needed. - fn try_poll_next( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - ) -> Poll<Option<Result<Self::Ok, Self::Error>>>; + fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) + -> Poll<Option<Result<Self::Ok, Self::Error>>>; } impl<S, T, E> TryStream for S -where - S: ?Sized + Stream<Item = Result<T, E>>, + where S: ?Sized + Stream<Item = Result<T, E>> { type Ok = T; type Error = E; - fn try_poll_next( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - ) -> Poll<Option<Result<Self::Ok, Self::Error>>> { + fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) + -> Poll<Option<Result<Self::Ok, Self::Error>>> + { self.poll_next(cx) } } #[cfg(feature = "alloc")] mod if_alloc { - use super::*; use alloc::boxed::Box; + use super::*; impl<S: ?Sized + Stream + Unpin> Stream for Box<S> { type Item = S::Item; - fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { + fn poll_next( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll<Option<Self::Item>> { Pin::new(&mut **self).poll_next(cx) } @@ -218,7 +226,10 @@ mod if_alloc { impl<S: Stream> Stream for std::panic::AssertUnwindSafe<S> { type Item = S::Item; - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S::Item>> { + fn poll_next( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll<Option<S::Item>> { unsafe { self.map_unchecked_mut(|x| &mut x.0) }.poll_next(cx) } diff --git a/src/task/__internal/atomic_waker.rs b/src/task/__internal/atomic_waker.rs index d49d043..213355b 100644 --- a/src/task/__internal/atomic_waker.rs +++ b/src/task/__internal/atomic_waker.rs @@ -1,7 +1,7 @@ use core::cell::UnsafeCell; use core::fmt; use core::sync::atomic::AtomicUsize; -use core::sync::atomic::Ordering::{AcqRel, Acquire, Release}; +use core::sync::atomic::Ordering::{Acquire, Release, AcqRel}; use core::task::Waker; /// A synchronization primitive for task wakeup. @@ -202,7 +202,10 @@ impl AtomicWaker { trait AssertSync: Sync {} impl AssertSync for Waker {} - Self { state: AtomicUsize::new(WAITING), waker: UnsafeCell::new(None) } + Self { + state: AtomicUsize::new(WAITING), + waker: UnsafeCell::new(None), + } } /// Registers the waker to be notified on calls to `wake`. @@ -276,7 +279,8 @@ impl AtomicWaker { // nothing to acquire, only release. In case of concurrent // wakers, we need to acquire their releases, so success needs // to do both. - let res = self.state.compare_exchange(REGISTERING, WAITING, AcqRel, Acquire); + let res = self.state.compare_exchange( + REGISTERING, WAITING, AcqRel, Acquire); match res { Ok(_) => { @@ -340,7 +344,9 @@ impl AtomicWaker { // // We just want to maintain memory safety. It is ok to drop the // call to `register`. - debug_assert!(state == REGISTERING || state == REGISTERING | WAKING); + debug_assert!( + state == REGISTERING || + state == REGISTERING | WAKING); } } } @@ -385,8 +391,9 @@ impl AtomicWaker { // not. // debug_assert!( - state == REGISTERING || state == REGISTERING | WAKING || state == WAKING - ); + state == REGISTERING || + state == REGISTERING | WAKING || + state == WAKING); None } } diff --git a/src/task/__internal/mod.rs b/src/task/__internal/mod.rs index c902eb4..77e3678 100644 --- a/src/task/__internal/mod.rs +++ b/src/task/__internal/mod.rs @@ -1,4 +1,4 @@ -#[cfg(not(futures_no_atomic_cas))] +#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))] mod atomic_waker; -#[cfg(not(futures_no_atomic_cas))] +#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))] pub use self::atomic_waker::AtomicWaker; diff --git a/src/task/mod.rs b/src/task/mod.rs index 19e4eae..f945d5d 100644 --- a/src/task/mod.rs +++ b/src/task/mod.rs @@ -7,4 +7,4 @@ mod poll; pub mod __internal; #[doc(no_inline)] -pub use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; +pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable}; diff --git a/src/task/poll.rs b/src/task/poll.rs index 607e78e..8fe294c 100644 --- a/src/task/poll.rs +++ b/src/task/poll.rs @@ -3,10 +3,9 @@ /// This macro bakes in propagation of `Pending` signals by returning early. #[macro_export] macro_rules! ready { - ($e:expr $(,)?) => { - match $e { - $crate::task::Poll::Ready(t) => t, - $crate::task::Poll::Pending => return $crate::task::Poll::Pending, - } - }; + ($e:expr $(,)?) => (match $e { + $crate::__private::Poll::Ready(t) => t, + $crate::__private::Poll::Pending => + return $crate::__private::Poll::Pending, + }) } |