aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2023-02-16 10:41:40 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-02-16 10:41:40 +0000
commit7b5f1bc38dca2154a069a0df1163d68cd9129995 (patch)
treeafe8e1e84a1e5909e1209a92799f39dcadac07c9
parentbe52958689f594a611217794cce860b7df4f2695 (diff)
parent82f1c1713eba6b087700e4d0db6463d00f2cf534 (diff)
downloadfutures-7b5f1bc38dca2154a069a0df1163d68cd9129995.tar.gz
Upgrade futures to 0.3.26 am: 4c9fd15119 am: 7de90dad0e am: 82f1c1713e
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/futures/+/2438289 Change-Id: I4196ed56746e0c1757920a860c44bf5071d26f65 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp2
-rw-r--r--Cargo.toml16
-rw-r--r--Cargo.toml.orig16
-rw-r--r--METADATA10
-rw-r--r--README.md6
-rw-r--r--tests/async_await_macros.rs2
-rw-r--r--tests/auto_traits.rs4
-rw-r--r--tests/eventual.rs18
-rw-r--r--tests/future_shared.rs46
-rw-r--r--tests/stream_futures_ordered.rs24
11 files changed, 118 insertions, 28 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index c68093a..c5e5d7e 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "77d82198c5afd04af3e760a6aa50b7e875289fc3"
+ "sha1": "5e3693a350f96244151081d2c030208cd15f9572"
},
"path_in_vcs": "futures"
} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 0e41e22..2acdd2c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -42,7 +42,7 @@ rust_library {
host_supported: true,
crate_name: "futures",
cargo_env_compat: true,
- cargo_pkg_version: "0.3.25",
+ cargo_pkg_version: "0.3.26",
srcs: ["src/lib.rs"],
edition: "2018",
features: [
diff --git a/Cargo.toml b/Cargo.toml
index 4a025a8..51e052a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2018"
rust-version = "1.45"
name = "futures"
-version = "0.3.25"
+version = "0.3.26"
description = """
An implementation of futures and streams featuring zero allocations,
composability, and iterator-like interfaces.
@@ -47,33 +47,33 @@ features = [
]
[dependencies.futures-channel]
-version = "0.3.25"
+version = "0.3.26"
features = ["sink"]
default-features = false
[dependencies.futures-core]
-version = "0.3.25"
+version = "0.3.26"
default-features = false
[dependencies.futures-executor]
-version = "0.3.25"
+version = "0.3.26"
optional = true
default-features = false
[dependencies.futures-io]
-version = "0.3.25"
+version = "0.3.26"
default-features = false
[dependencies.futures-sink]
-version = "0.3.25"
+version = "0.3.26"
default-features = false
[dependencies.futures-task]
-version = "0.3.25"
+version = "0.3.26"
default-features = false
[dependencies.futures-util]
-version = "0.3.25"
+version = "0.3.26"
features = ["sink"]
default-features = false
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 544a1e3..e7a5f38 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "futures"
-version = "0.3.25"
+version = "0.3.26"
edition = "2018"
rust-version = "1.45"
license = "MIT OR Apache-2.0"
@@ -15,13 +15,13 @@ composability, and iterator-like interfaces.
categories = ["asynchronous"]
[dependencies]
-futures-core = { path = "../futures-core", version = "0.3.25", default-features = false }
-futures-task = { path = "../futures-task", version = "0.3.25", default-features = false }
-futures-channel = { path = "../futures-channel", version = "0.3.25", default-features = false, features = ["sink"] }
-futures-executor = { path = "../futures-executor", version = "0.3.25", default-features = false, optional = true }
-futures-io = { path = "../futures-io", version = "0.3.25", default-features = false }
-futures-sink = { path = "../futures-sink", version = "0.3.25", default-features = false }
-futures-util = { path = "../futures-util", version = "0.3.25", default-features = false, features = ["sink"] }
+futures-core = { path = "../futures-core", version = "0.3.26", default-features = false }
+futures-task = { path = "../futures-task", version = "0.3.26", default-features = false }
+futures-channel = { path = "../futures-channel", version = "0.3.26", default-features = false, features = ["sink"] }
+futures-executor = { path = "../futures-executor", version = "0.3.26", default-features = false, optional = true }
+futures-io = { path = "../futures-io", version = "0.3.26", default-features = false }
+futures-sink = { path = "../futures-sink", version = "0.3.26", default-features = false }
+futures-util = { path = "../futures-util", version = "0.3.26", default-features = false, features = ["sink"] }
[dev-dependencies]
futures-executor = { path = "../futures-executor", features = ["thread-pool"] }
diff --git a/METADATA b/METADATA
index 1dee576..240fa20 100644
--- a/METADATA
+++ b/METADATA
@@ -11,13 +11,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/futures/futures-0.3.25.crate"
+ value: "https://static.crates.io/crates/futures/futures-0.3.26.crate"
}
- version: "0.3.25"
+ version: "0.3.26"
license_type: NOTICE
last_upgrade_date {
- year: 2022
- month: 12
- day: 12
+ year: 2023
+ month: 2
+ day: 15
}
}
diff --git a/README.md b/README.md
index e6127fd..45e1f5b 100644
--- a/README.md
+++ b/README.md
@@ -8,16 +8,16 @@
<p align="center">
<a href="https://github.com/rust-lang/futures-rs/actions?query=branch%3Amaster">
- <img alt="Build Status" src="https://img.shields.io/github/workflow/status/rust-lang/futures-rs/CI/master">
+ <img alt="Build Status" src="https://img.shields.io/github/actions/workflow/status/rust-lang/futures-rs/ci.yml?branch=master">
</a>
<a href="https://crates.io/crates/futures">
- <img alt="Crates.io" src="https://img.shields.io/crates/v/futures.svg">
+ <img alt="crates.io" src="https://img.shields.io/crates/v/futures.svg">
</a>
</p>
<p align="center">
- <a href="https://docs.rs/futures/">
+ <a href="https://docs.rs/futures">
Documentation
</a> | <a href="https://rust-lang.github.io/futures-rs/">
Website
diff --git a/tests/async_await_macros.rs b/tests/async_await_macros.rs
index 250e345..82a617f 100644
--- a/tests/async_await_macros.rs
+++ b/tests/async_await_macros.rs
@@ -380,11 +380,13 @@ fn try_join_size() {
assert_eq!(mem::size_of_val(&fut), 48);
}
+#[allow(clippy::let_underscore_future)]
#[test]
fn join_doesnt_require_unpin() {
let _ = async { join!(async {}, async {}) };
}
+#[allow(clippy::let_underscore_future)]
#[test]
fn try_join_doesnt_require_unpin() {
let _ = async { try_join!(async { Ok::<(), ()>(()) }, async { Ok::<(), ()>(()) },) };
diff --git a/tests/auto_traits.rs b/tests/auto_traits.rs
index da00ccf..5fc0f7d 100644
--- a/tests/auto_traits.rs
+++ b/tests/auto_traits.rs
@@ -1480,10 +1480,10 @@ pub mod stream {
assert_not_impl!(PollImmediate<PinnedStream>: Unpin);
assert_impl!(ReadyChunks<SendStream<()>>: Send);
- assert_not_impl!(ReadyChunks<SendStream>: Send);
+ assert_impl!(ReadyChunks<SendStream>: Send);
assert_not_impl!(ReadyChunks<LocalStream>: Send);
assert_impl!(ReadyChunks<SyncStream<()>>: Sync);
- assert_not_impl!(ReadyChunks<SyncStream>: Sync);
+ assert_impl!(ReadyChunks<SyncStream>: Sync);
assert_not_impl!(ReadyChunks<LocalStream>: Sync);
assert_impl!(ReadyChunks<UnpinStream>: Unpin);
assert_not_impl!(ReadyChunks<PinnedStream>: Unpin);
diff --git a/tests/eventual.rs b/tests/eventual.rs
index 951c55c..57a49b2 100644
--- a/tests/eventual.rs
+++ b/tests/eventual.rs
@@ -16,6 +16,8 @@ fn join1() {
run(future::try_join(ok::<i32, i32>(1), ok(2)).map_ok(move |v| tx.send(v).unwrap()));
assert_eq!(rx.recv(), Ok((1, 2)));
assert!(rx.recv().is_err());
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -30,6 +32,8 @@ fn join2() {
c2.send(2).unwrap();
assert_eq!(rx.recv(), Ok((1, 2)));
assert!(rx.recv().is_err());
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -43,6 +47,8 @@ fn join3() {
assert_eq!(rx.recv(), Ok(1));
assert!(rx.recv().is_err());
drop(c2);
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -56,6 +62,8 @@ fn join4() {
assert!(rx.recv().is_ok());
drop(c2);
assert!(rx.recv().is_err());
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -73,6 +81,8 @@ fn join5() {
c3.send(3).unwrap();
assert_eq!(rx.recv(), Ok(((1, 2), 3)));
assert!(rx.recv().is_err());
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -92,6 +102,8 @@ fn select1() {
c2.send(2).unwrap();
assert_eq!(rx.recv(), Ok(2));
assert!(rx.recv().is_err());
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -111,6 +123,8 @@ fn select2() {
c2.send(2).unwrap();
assert_eq!(rx.recv(), Ok(2));
assert!(rx.recv().is_err());
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -130,6 +144,8 @@ fn select3() {
drop(c2);
assert_eq!(rx.recv(), Ok(2));
assert!(rx.recv().is_err());
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
#[test]
@@ -158,4 +174,6 @@ fn select4() {
drop(tx);
t.join().unwrap();
+
+ std::thread::sleep(std::time::Duration::from_millis(500)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
}
diff --git a/tests/future_shared.rs b/tests/future_shared.rs
index 6bf43d2..bd69c1d 100644
--- a/tests/future_shared.rs
+++ b/tests/future_shared.rs
@@ -152,6 +152,52 @@ fn downgrade() {
}
#[test]
+fn ptr_eq() {
+ use future::FusedFuture;
+ use std::collections::hash_map::DefaultHasher;
+ use std::hash::Hasher;
+
+ let (tx, rx) = oneshot::channel::<i32>();
+ let shared = rx.shared();
+ let mut shared2 = shared.clone();
+ let mut hasher = DefaultHasher::new();
+ let mut hasher2 = DefaultHasher::new();
+
+ // Because these two futures share the same underlying future,
+ // `ptr_eq` should return true.
+ assert!(shared.ptr_eq(&shared2));
+ // Equivalence relations are symmetric
+ assert!(shared2.ptr_eq(&shared));
+
+ // If `ptr_eq` returns true, they should hash to the same value.
+ shared.ptr_hash(&mut hasher);
+ shared2.ptr_hash(&mut hasher2);
+ assert_eq!(hasher.finish(), hasher2.finish());
+
+ tx.send(42).unwrap();
+ assert_eq!(block_on(&mut shared2).unwrap(), 42);
+
+ // Now that `shared2` has completed, `ptr_eq` should return false.
+ assert!(shared2.is_terminated());
+ assert!(!shared.ptr_eq(&shared2));
+
+ // `ptr_eq` should continue to work for the other `Shared`.
+ let shared3 = shared.clone();
+ let mut hasher3 = DefaultHasher::new();
+ assert!(shared.ptr_eq(&shared3));
+
+ shared3.ptr_hash(&mut hasher3);
+ assert_eq!(hasher.finish(), hasher3.finish());
+
+ let (_tx, rx) = oneshot::channel::<i32>();
+ let shared4 = rx.shared();
+
+ // And `ptr_eq` should return false for two futures that don't share
+ // the underlying future.
+ assert!(!shared.ptr_eq(&shared4));
+}
+
+#[test]
fn dont_clone_in_single_owner_shared_future() {
let counter = CountClone(Rc::new(Cell::new(0)));
let (tx, rx) = oneshot::channel();
diff --git a/tests/stream_futures_ordered.rs b/tests/stream_futures_ordered.rs
index 8b85a33..5a4a3e2 100644
--- a/tests/stream_futures_ordered.rs
+++ b/tests/stream_futures_ordered.rs
@@ -146,3 +146,27 @@ fn queue_never_unblocked() {
assert!(stream.poll_next_unpin(cx).is_pending());
assert!(stream.poll_next_unpin(cx).is_pending());
}
+
+#[test]
+fn test_push_front_negative() {
+ let (a_tx, a_rx) = oneshot::channel::<i32>();
+ let (b_tx, b_rx) = oneshot::channel::<i32>();
+ let (c_tx, c_rx) = oneshot::channel::<i32>();
+
+ let mut stream = FuturesOrdered::new();
+
+ let mut cx = noop_context();
+
+ stream.push_front(a_rx);
+ stream.push_front(b_rx);
+ stream.push_front(c_rx);
+
+ a_tx.send(1).unwrap();
+ b_tx.send(2).unwrap();
+ c_tx.send(3).unwrap();
+
+ // These should all be recieved in reverse order
+ assert_eq!(Poll::Ready(Some(Ok(3))), stream.poll_next_unpin(&mut cx));
+ assert_eq!(Poll::Ready(Some(Ok(2))), stream.poll_next_unpin(&mut cx));
+ assert_eq!(Poll::Ready(Some(Ok(1))), stream.poll_next_unpin(&mut cx));
+}