Skip to content

Commit

Permalink
Address soundness issue in futures-util
Browse files Browse the repository at this point in the history
This is technically a breaking change, but allowed since it fixes a
soundness issue in futures-util (rust-lang/futures-rs#2830).

Fixes #8.
Closes #9.
  • Loading branch information
jonhoo committed Oct 19, 2024
1 parent baef299 commit 77ddfc1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "streamunordered"
version = "0.5.3"
version = "0.5.4"
authors = ["Jon Gjengset <jon@thesquareplanet.com>"]
license = "MIT/Apache-2.0"
edition = "2018"
Expand All @@ -20,7 +20,7 @@ maintenance = { status = "passively-maintained" }
[dependencies]
futures-core = "0.3.0"
futures-sink = "0.3.0"
futures-util = "0.3.0"
futures-util = "0.3.31"
slab = "0.4.0"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ where
}
}

impl<S: Stream> Stream for StreamUnordered<S> {
impl<S: Stream + 'static> Stream for StreamUnordered<S> {
type Item = (StreamYield<S>, usize);

fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Expand Down Expand Up @@ -979,7 +979,7 @@ impl<S: Stream> FromIterator<S> for StreamUnordered<S> {
}
}

impl<S: Stream> FusedStream for StreamUnordered<S> {
impl<S: Stream + 'static> FusedStream for StreamUnordered<S> {
fn is_terminated(&self) -> bool {
self.is_terminated.load(Relaxed)
}
Expand Down
4 changes: 3 additions & 1 deletion src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ impl<S> ArcWake for Task<S> {
}
}

impl<S> Task<S> {
impl<S: 'static> Task<S> {
/// Returns a waker reference for this task without cloning the Arc.
pub(super) fn waker_ref(this: &Arc<Task<S>>) -> WakerRef<'_> {
waker_ref(this)
}
}

impl<S> Task<S> {
/// Spins until `next_all` is no longer set to `pending_next_all`.
///
/// The temporary `pending_next_all` value is typically overwritten fairly
Expand Down

0 comments on commit 77ddfc1

Please sign in to comment.