-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.3 backport #2631
Merged
Merged
0.3 backport #2631
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` error: the feature `cfg_target_has_atomic` has been stable since 1.60.0 and no longer requires an attribute to enable --> futures/tests/no-std/src/lib.rs:3:12 | 3 | #![feature(cfg_target_has_atomic)] | ^^^^^^^^^^^^^^^^^^^^^ ```
``` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> futures-executor/src/thread_pool.rs:349:9 | 349 | / match arc_self.mutex.notify() { 350 | | Ok(task) => arc_self.exec.state.send(Message::Run(task)), 351 | | Err(()) => {} 352 | | } | |_________^ help: try this: `if let Ok(task) = arc_self.mutex.notify() { arc_self.exec.state.send(Message::Run(task)) }` | = note: `-D clippy::single-match` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match ```
The IntoIter impl advances the head pointer every iteration, but this breaks the linked list invariant that the head's prev should be null. If the iteration is not done to completion, on subsequent drop, FuturesUnordered::unlink relies on this broken invariant and ends up panicking. The fix is to maintain the `head->prev == null` invariant while iterating. Also added a test for this bug.
Updates the docs to use the same phrasing as `.buffered()` https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html#method.buffered
LocalPool::try_run_one and run_until_stalled now correctly re-try when a future "yields" by calling wake and returning Pending.
``` error: unresolved link to `select` --> futures-util/src/future/try_future/mod.rs:272:17 | 272 | /// using [`select!`] or [`join!`]. | ^^^^^^^ no item named `select` in scope | = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings` = note: `macro_rules` named `select` exists in this crate, but it is not in scope at this link's location error: unresolved link to `join` --> futures-util/src/future/try_future/mod.rs:272:32 | 272 | /// using [`select!`] or [`join!`]. | ^^^^^ no item named `join` in scope | = note: `macro_rules` named `join` exists in this crate, but it is not in scope at this link's location error: unresolved link to `select` --> futures-util/src/future/try_future/mod.rs:320:27 | 320 | /// type when using [`select!`] or [`join!`]. | ^^^^^^^ no item named `select` in scope | = note: `macro_rules` named `select` exists in this crate, but it is not in scope at this link's location error: unresolved link to `join` --> futures-util/src/future/try_future/mod.rs:320:42 | 320 | /// type when using [`select!`] or [`join!`]. | ^^^^^ no item named `join` in scope | = note: `macro_rules` named `join` exists in this crate, but it is not in scope at this link's location error: unresolved link to `select` --> futures-util/src/stream/stream/mod.rs:1802:15 | 1802 | /// the [`select!`] macro. | ^^^^^^^ no item named `select` in scope | = note: `macro_rules` named `select` exists in this crate, but it is not in scope at this link's location ```
Although a relatively small change, it makes the code a little bit more readable than the originally nested `match` expressions.
Fixes a minor typo by changing "a tasks" to "a task" in the documentation comment for enter. Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Clippy now respects `rust-version` field in Cargo.toml. rust-lang/rust-clippy@b776fb8
``` warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/future/select_all.rs:62:28 | 62 | let rest = mem::replace(&mut self.inner, Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut self.inner)` | = note: `#[warn(clippy::mem_replace_with_default)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/future/select_ok.rs:62:40 | 62 | ... let rest = mem::replace(&mut self.inner, Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut self.inner)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/stream/stream/collect.rs:22:9 | 22 | mem::replace(self.project().collection, Default::default()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(self.project().collection)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/stream/stream/unzip.rs:24:10 | 24 | (mem::replace(this.left, Default::default()), mem::replace(this.right, Default::default())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(this.left)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/stream/stream/unzip.rs:24:55 | 24 | (mem::replace(this.left, Default::default()), mem::replace(this.right, Default::default())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(this.right)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/stream/stream/chunks.rs:69:40 | 69 | let full_buf = mem::replace(this.items, Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(this.items)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/stream/stream/ready_chunks.rs:77:40 | 77 | let full_buf = mem::replace(this.items, Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(this.items)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/stream/try_stream/try_collect.rs:48:31 | 48 | None => break mem::replace(this.items, Default::default()), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(this.items)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/stream/try_stream/try_chunks.rs:74:40 | 74 | let full_buf = mem::replace(this.items, Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(this.items)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/io/lines.rs:45:29 | 45 | Poll::Ready(Some(Ok(mem::replace(this.buf, String::new())))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(this.buf)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/io/read_exact.rs:33:33 | 33 | let (_, rest) = mem::replace(&mut this.buf, &mut []).split_at_mut(n); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut this.buf)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/io/read_line.rs:25:31 | 25 | Self { reader, bytes: mem::replace(buf, String::new()).into_bytes(), buf, read: 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(buf)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/io/read_to_string.rs:25:31 | 25 | Self { reader, bytes: mem::replace(buf, String::new()).into_bytes(), buf, start_len } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(buf)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures-util/src/io/write_all.rs:33:33 | 33 | let (_, rest) = mem::replace(&mut this.buf, &[]).split_at(n); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut this.buf)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> futures/tests/sink.rs:141:9 | 141 | mem::replace(&mut self.data, Vec::new()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut self.data)` | = note: `#[warn(clippy::mem_replace_with_default)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default ```
Those functions are trivial and non-generic. It's necessary to use `#[inline]` to enable cross-crate inlining for non-generic functions when LTO is disabled.
``` error: failed to get `assert_matches` as a dependency of package `futures v0.4.0-alpha.0 (/home/runner/work/futures-rs/futures-rs/futures)` Caused by: failed to load source for dependency `assert_matches` Caused by: Unable to update registry `https://github.com/rust-lang/crates.io-index` Caused by: failed to fetch `https://github.com/rust-lang/crates.io-index` Caused by: error reading from the zlib stream; class=Zlib (5) ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backports:
try_buffered
docs. #2579select
benchmark #2582Fuse
s fromselect
, and only poll non-terminated streams #2583futures_util::future::select
#2587FuturesOrdered
dynamically intry_join_all
#2556LocalPool
waker #2608doc(alias)
pending()
tonever
#2613Postponed (cherry-pick failed):