Upgrade rust/crates/futures-executor to 0.3.12
Test: make
Change-Id: I12d01f1fee572bd237ca5f26f369e7ae2e65ddc6
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
new file mode 100644
index 0000000..4fd4ba3
--- /dev/null
+++ b/.cargo_vcs_info.json
@@ -0,0 +1,5 @@
+{
+ "git": {
+ "sha1": "1d53a29ec16ccd5b094fb205edb73591455eb4b6"
+ }
+}
diff --git a/Android.bp b/Android.bp
index 1db33d8..1bbc855 100644
--- a/Android.bp
+++ b/Android.bp
@@ -24,17 +24,12 @@
}
// dependent_library ["feature_list"]
-// futures-core-0.3.8 "alloc,std"
-// futures-task-0.3.8 "alloc,once_cell,std"
-// futures-util-0.3.8 "alloc,slab,std"
-// libc-0.2.80 "default,std"
+// futures-core-0.3.12 "alloc,std"
+// futures-task-0.3.12 "alloc,once_cell,std"
+// futures-util-0.3.12 "alloc,slab,std"
+// libc-0.2.86 "default,std"
// num_cpus-1.13.0
// once_cell-1.5.2 "alloc,std"
-// pin-project-1.0.2
-// pin-project-internal-1.0.2
+// pin-project-lite-0.2.4
// pin-utils-0.1.0
-// proc-macro2-1.0.24 "default,proc-macro"
-// quote-1.0.7 "default,proc-macro"
// slab-0.4.2
-// syn-1.0.53 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote,visit-mut"
-// unicode-xid-0.2.1 "default"
diff --git a/Cargo.toml b/Cargo.toml
index 429a25d..800bbdb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,32 +13,34 @@
[package]
edition = "2018"
name = "futures-executor"
-version = "0.3.7"
+version = "0.3.12"
authors = ["Alex Crichton <[email protected]>"]
description = "Executors for asynchronous tasks based on the futures-rs library.\n"
homepage = "https://rust-lang.github.io/futures-rs"
-documentation = "https://docs.rs/futures-executor/0.3.7"
+documentation = "https://docs.rs/futures-executor/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"]
[dependencies.futures-core]
-version = "0.3.7"
+version = "0.3.12"
default-features = false
[dependencies.futures-task]
-version = "0.3.7"
+version = "0.3.12"
default-features = false
[dependencies.futures-util]
-version = "0.3.7"
+version = "0.3.12"
default-features = false
[dependencies.num_cpus]
version = "1.8.0"
optional = true
+[dev-dependencies]
+
[features]
default = ["std"]
std = ["futures-core/std", "futures-task/std", "futures-util/std"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 579ee9a..143356a 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,12 +1,12 @@
[package]
name = "futures-executor"
edition = "2018"
-version = "0.3.7"
+version = "0.3.12"
authors = ["Alex Crichton <[email protected]>"]
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-executor/0.3.7"
+documentation = "https://docs.rs/futures-executor/0.3"
description = """
Executors for asynchronous tasks based on the futures-rs library.
"""
@@ -17,11 +17,14 @@
thread-pool = ["std", "num_cpus"]
[dependencies]
-futures-core = { path = "../futures-core", version = "0.3.7", default-features = false }
-futures-task = { path = "../futures-task", version = "0.3.7", default-features = false }
-futures-util = { path = "../futures-util", version = "0.3.7", default-features = false }
+futures-core = { path = "../futures-core", version = "0.3.12", default-features = false }
+futures-task = { path = "../futures-task", version = "0.3.12", default-features = false }
+futures-util = { path = "../futures-util", version = "0.3.12", default-features = false }
num_cpus = { version = "1.8.0", optional = true }
+[dev-dependencies]
+futures = { path = "../futures" }
+
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
diff --git a/METADATA b/METADATA
index 9b8b9ae..bd72b7c 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/futures-executor/futures-executor-0.3.7.crate"
+ value: "https://static.crates.io/crates/futures-executor/futures-executor-0.3.12.crate"
}
- version: "0.3.7"
+ version: "0.3.12"
license_type: NOTICE
last_upgrade_date {
- year: 2020
- month: 10
- day: 25
+ year: 2021
+ month: 2
+ day: 9
}
}
diff --git a/src/lib.rs b/src/lib.rs
index a8ba5c8..b679649 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,40 @@
//! Built-in executors and related tools.
//!
-//! All items of this library are only available when the `std` feature of this
+//! All asynchronous computation occurs within an executor, which is
+//! capable of spawning futures as tasks. This module provides several
+//! built-in executors, as well as tools for building your own.
+//!
+//! All items are only available when the `std` feature of this
//! library is activated, and it is activated by default.
+//!
+//! # Using a thread pool (M:N task scheduling)
+//!
+//! Most of the time tasks should be executed on a [thread pool](ThreadPool).
+//! A small set of worker threads can handle a very large set of spawned tasks
+//! (which are much lighter weight than threads). Tasks spawned onto the pool
+//! with the [`spawn_ok`](ThreadPool::spawn_ok) function will run ambiently on
+//! the created threads.
+//!
+//! # Spawning additional tasks
+//!
+//! Tasks can be spawned onto a spawner by calling its [`spawn_obj`] method
+//! directly. In the case of `!Send` futures, [`spawn_local_obj`] can be used
+//! instead.
+//!
+//! # Single-threaded execution
+//!
+//! In addition to thread pools, it's possible to run a task (and the tasks
+//! it spawns) entirely within a single thread via the [`LocalPool`] executor.
+//! Aside from cutting down on synchronization costs, this executor also makes
+//! it possible to spawn non-`Send` tasks, via [`spawn_local_obj`]. The
+//! [`LocalPool`] is best suited for running I/O-bound tasks that do relatively
+//! little work between I/O operations.
+//!
+//! There is also a convenience function [`block_on`] for simply running a
+//! future to completion on the current thread.
+//!
+//! [`spawn_obj`]: https://docs.rs/futures/0.3/futures/task/trait.Spawn.html#tymethod.spawn_obj
+//! [`spawn_local_obj`]: https://docs.rs/futures/0.3/futures/task/trait.LocalSpawn.html#tymethod.spawn_local_obj
#![cfg_attr(not(feature = "std"), no_std)]
@@ -9,16 +42,8 @@
// 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))]
#![warn(clippy::all)]
-
-// mem::take requires Rust 1.40, matches! requires Rust 1.42
-// Can be removed if the minimum supported version increased or if https://github.com/rust-lang/rust-clippy/issues/3941
-// get's implemented.
-#![allow(clippy::mem_replace_with_default, clippy::match_like_matches_macro)]
-
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
-#![doc(html_root_url = "https://docs.rs/futures-executor/0.3.7")]
-
#![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg(feature = "std")]
diff --git a/src/local_pool.rs b/src/local_pool.rs
index b089a80..156d5cc 100644
--- a/src/local_pool.rs
+++ b/src/local_pool.rs
@@ -118,8 +118,8 @@
impl LocalPool {
/// Create a new, empty pool of tasks.
- pub fn new() -> LocalPool {
- LocalPool {
+ pub fn new() -> Self {
+ Self {
pool: FuturesUnordered::new(),
incoming: Default::default(),
}
diff --git a/src/thread_pool.rs b/src/thread_pool.rs
index 3247aa3..741e6d9 100644
--- a/src/thread_pool.rs
+++ b/src/thread_pool.rs
@@ -80,7 +80,7 @@
/// See documentation for the methods in
/// [`ThreadPoolBuilder`](ThreadPoolBuilder) for details on the default
/// configuration.
- pub fn new() -> Result<ThreadPool, io::Error> {
+ pub fn new() -> Result<Self, io::Error> {
ThreadPoolBuilder::new().create()
}
@@ -168,9 +168,9 @@
}
impl Clone for ThreadPool {
- fn clone(&self) -> ThreadPool {
+ fn clone(&self) -> Self {
self.state.cnt.fetch_add(1, Ordering::Relaxed);
- ThreadPool { state: self.state.clone() }
+ Self { state: self.state.clone() }
}
}
@@ -313,7 +313,7 @@
/// Actually run the task (invoking `poll` on the future) on the current
/// thread.
fn run(self) {
- let Task { mut future, wake_handle, mut exec } = self;
+ let Self { mut future, wake_handle, mut exec } = self;
let waker = waker_ref(&wake_handle);
let mut cx = Context::from_waker(&waker);
@@ -328,7 +328,7 @@
Poll::Pending => {}
Poll::Ready(()) => return wake_handle.mutex.complete(),
}
- let task = Task {
+ let task = Self {
future,
wake_handle: wake_handle.clone(),
exec,
diff --git a/src/unpark_mutex.rs b/src/unpark_mutex.rs
index 1f69aed..c49c64c 100644
--- a/src/unpark_mutex.rs
+++ b/src/unpark_mutex.rs
@@ -43,8 +43,8 @@
const COMPLETE: usize = 3; // No transitions out
impl<D> UnparkMutex<D> {
- pub(crate) fn new() -> UnparkMutex<D> {
- UnparkMutex {
+ pub(crate) fn new() -> Self {
+ Self {
status: AtomicUsize::new(WAITING),
inner: UnsafeCell::new(None),
}