diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-02-02 23:53:03 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-02-02 23:53:03 +0000 |
commit | d600df26afbaf95e954db3255b4d6ca44a2f6d2a (patch) | |
tree | eae9b550f3c20c1f11cca9d77bec2e7c7c4e9467 | |
parent | 8e6bea5cfada0de0e7e72da2e97ad978859f68ba (diff) | |
parent | fe1da41207dec108a4f82a67427f615c20d75b8a (diff) | |
download | futures-test-simpleperf-release.tar.gz |
Snap for 11400057 from fe1da41207dec108a4f82a67427f615c20d75b8a to simpleperf-releasesimpleperf-release
Change-Id: Idbfcadbe2f57f84be27b4a523e9a3912185306f1
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | Cargo.toml | 18 | ||||
-rw-r--r-- | Cargo.toml.orig | 18 | ||||
-rw-r--r-- | METADATA | 23 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/assert_unmoved.rs | 24 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/task/mod.rs | 20 |
9 files changed, 52 insertions, 61 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index f986bf2..941a78c 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "5e3693a350f96244151081d2c030208cd15f9572" + "sha1": "de1a0fd64a1bcae9a1534ed4da1699632993cc26" }, "path_in_vcs": "futures-test" }
\ No newline at end of file @@ -42,7 +42,7 @@ rust_test { host_supported: true, crate_name: "futures_test", cargo_env_compat: true, - cargo_pkg_version: "0.3.26", + cargo_pkg_version: "0.3.30", srcs: ["src/lib.rs"], test_suites: ["general-tests"], auto_gen_config: true, @@ -72,7 +72,7 @@ rust_library { host_supported: true, crate_name: "futures_test", cargo_env_compat: true, - cargo_pkg_version: "0.3.26", + cargo_pkg_version: "0.3.30", srcs: ["src/lib.rs"], edition: "2018", features: [ @@ -11,9 +11,9 @@ [package] edition = "2018" -rust-version = "1.45" +rust-version = "1.56" name = "futures-test" -version = "0.3.26" +version = "0.3.30" description = """ Common utilities for testing components built off futures-rs. """ @@ -26,31 +26,31 @@ repository = "https://github.com/rust-lang/futures-rs" all-features = true [dependencies.futures-core] -version = "0.3.26" +version = "0.3.30" default-features = false [dependencies.futures-executor] -version = "0.3.26" +version = "0.3.30" default-features = false [dependencies.futures-io] -version = "0.3.26" +version = "0.3.30" default-features = false [dependencies.futures-macro] -version = "=0.3.26" +version = "=0.3.30" default-features = false [dependencies.futures-sink] -version = "0.3.26" +version = "0.3.30" default-features = false [dependencies.futures-task] -version = "0.3.26" +version = "0.3.30" default-features = false [dependencies.futures-util] -version = "0.3.26" +version = "0.3.30" default-features = false [dependencies.pin-project] diff --git a/Cargo.toml.orig b/Cargo.toml.orig index e2ae339..8499e03 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,8 +1,8 @@ [package] name = "futures-test" -version = "0.3.26" +version = "0.3.30" edition = "2018" -rust-version = "1.45" +rust-version = "1.56" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/futures-rs" homepage = "https://rust-lang.github.io/futures-rs" @@ -11,13 +11,13 @@ Common utilities for testing components built off futures-rs. """ [dependencies] -futures-core = { version = "0.3.26", path = "../futures-core", default-features = false } -futures-task = { version = "0.3.26", path = "../futures-task", default-features = false } -futures-io = { version = "0.3.26", path = "../futures-io", default-features = false } -futures-util = { version = "0.3.26", path = "../futures-util", default-features = false } -futures-executor = { version = "0.3.26", path = "../futures-executor", default-features = false } -futures-sink = { version = "0.3.26", path = "../futures-sink", default-features = false } -futures-macro = { version = "=0.3.26", path = "../futures-macro", default-features = false } +futures-core = { version = "0.3.30", path = "../futures-core", default-features = false } +futures-task = { version = "0.3.30", path = "../futures-task", default-features = false } +futures-io = { version = "0.3.30", path = "../futures-io", default-features = false } +futures-util = { version = "0.3.30", path = "../futures-util", default-features = false } +futures-executor = { version = "0.3.30", path = "../futures-executor", default-features = false } +futures-sink = { version = "0.3.30", path = "../futures-sink", default-features = false } +futures-macro = { version = "=0.3.30", path = "../futures-macro", default-features = false } pin-utils = { version = "0.1.0", default-features = false } pin-project = "1.0.11" @@ -1,23 +1,20 @@ # This project was upgraded with external_updater. -# Usage: tools/external_updater/updater.sh update rust/crates/futures-test -# 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-test +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md name: "futures-test" description: "()" third_party { - url { - type: HOMEPAGE - value: "https://crates.io/crates/futures-test" - } - url { - type: ARCHIVE - value: "https://static.crates.io/crates/futures-test/futures-test-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-test" + identifier { + type: "Archive" + value: "https://static.crates.io/crates/futures-test/futures-test-0.3.30.crate" + version: "0.3.30" } } @@ -11,7 +11,7 @@ Add this to your `Cargo.toml`: futures-test = "0.3" ``` -The current `futures-test` requires Rust 1.45 or later. +The current `futures-test` requires Rust 1.56 or later. ## License diff --git a/src/assert_unmoved.rs b/src/assert_unmoved.rs index 95d9a09..baeaeb5 100644 --- a/src/assert_unmoved.rs +++ b/src/assert_unmoved.rs @@ -7,7 +7,6 @@ use futures_io::{ use futures_sink::Sink; use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; -use std::ptr; use std::thread::panicking; /// Combinator that asserts that the underlying type is not moved after being polled. @@ -24,26 +23,21 @@ use std::thread::panicking; pub struct AssertUnmoved<T> { #[pin] inner: T, - this_ptr: *const Self, + this_addr: usize, } -// Safety: having a raw pointer in a struct makes it `!Send`, however the -// pointer is never dereferenced so this is safe. -unsafe impl<T: Send> Send for AssertUnmoved<T> {} -unsafe impl<T: Sync> Sync for AssertUnmoved<T> {} - impl<T> AssertUnmoved<T> { pub(crate) fn new(inner: T) -> Self { - Self { inner, this_ptr: ptr::null() } + Self { inner, this_addr: 0 } } fn poll_with<'a, U>(mut self: Pin<&'a mut Self>, f: impl FnOnce(Pin<&'a mut T>) -> U) -> U { - let cur_this = &*self as *const Self; - if self.this_ptr.is_null() { + let cur_this = &*self as *const Self as usize; + if self.this_addr == 0 { // First time being polled - *self.as_mut().project().this_ptr = cur_this; + *self.as_mut().project().this_addr = cur_this; } else { - assert_eq!(self.this_ptr, cur_this, "AssertUnmoved moved between poll calls"); + assert_eq!(self.this_addr, cur_this, "AssertUnmoved moved between poll calls"); } f(self.project().inner) } @@ -166,9 +160,9 @@ impl<T> PinnedDrop for AssertUnmoved<T> { fn drop(self: Pin<&mut Self>) { // If the thread is panicking then we can't panic again as that will // cause the process to be aborted. - if !panicking() && !self.this_ptr.is_null() { - let cur_this = &*self as *const Self; - assert_eq!(self.this_ptr, cur_this, "AssertUnmoved moved before drop"); + if !panicking() && self.this_addr != 0 { + let cur_this = &*self as *const Self as usize; + assert_eq!(self.this_addr, cur_this, "AssertUnmoved moved before drop"); } } } @@ -61,7 +61,7 @@ mod interleave_pending; mod track_closed; /// Enables an `async` test function. The generated future will be run to completion with -/// [`futures_executor::block_on`](futures_executor::block_on). +/// [`futures_executor::block_on`]. /// /// ``` /// #[futures_test::test] diff --git a/src/task/mod.rs b/src/task/mod.rs index cec645d..e10ecbb 100644 --- a/src/task/mod.rs +++ b/src/task/mod.rs @@ -15,29 +15,29 @@ //! [`Spawn`](futures_task::Spawn) implementations. //! //! Test contexts: -//! - [`noop_context`](crate::task::noop_context) creates a context that ignores calls to +//! - [`noop_context`] creates a context that ignores calls to //! [`cx.waker().wake_by_ref()`](futures_core::task::Waker). -//! - [`panic_context`](crate::task::panic_context) creates a context that panics when +//! - [`panic_context`] creates a context that panics when //! [`cx.waker().wake_by_ref()`](futures_core::task::Waker) is called. //! //! Test wakers: -//! - [`noop_waker`](crate::task::noop_waker) creates a waker that ignores calls to +//! - [`noop_waker`] creates a waker that ignores calls to //! [`wake`](futures_core::task::Waker). -//! - [`panic_waker`](crate::task::panic_waker) creates a waker that panics when +//! - [`panic_waker`](panic_waker()) creates a waker that panics when //! [`wake`](futures_core::task::Waker) is called. -//! - [`new_count_waker`](crate::task::new_count_waker) creates a waker that increments a counter whenever +//! - [`new_count_waker`] creates a waker that increments a counter whenever //! [`wake`](futures_core::task::Waker) is called. //! //! Test spawners: -//! - [`NoopSpawner`](crate::task::NoopSpawner) ignores calls to +//! - [`NoopSpawner`] ignores calls to //! [`spawn`](futures_util::task::SpawnExt::spawn) -//! - [`PanicSpawner`](crate::task::PanicSpawner) panics if [`spawn`](futures_util::task::SpawnExt::spawn) is +//! - [`PanicSpawner`] panics if [`spawn`](futures_util::task::SpawnExt::spawn) is //! called. -//! - [`RecordSpawner`](crate::task::RecordSpawner) records the spawned futures. +//! - [`RecordSpawner`] records the spawned futures. //! //! For convenience there additionally exist various functions that directly -//! return waker/spawner references: [`noop_waker_ref`](crate::task::noop_waker_ref), -//! [`panic_waker_ref`](crate::task::panic_waker_ref), [`noop_spawner_mut`](crate::task::noop_spawner_mut) and [`panic_spawner_mut`](crate::task::panic_spawner_mut). +//! return waker/spawner references: [`noop_waker_ref`], [`panic_waker_ref`], +//! [`noop_spawner_mut`] and [`panic_spawner_mut`]. mod context; pub use self::context::{noop_context, panic_context}; |