Skip to content
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

Release 0.3.29 #2791

Merged
merged 26 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bd8215b
Update actions/checkout action to v4
taiki-e Sep 6, 2023
818c2fc
ci: Fix MSRV build
taiki-e Jul 10, 2023
240c67a
Fix build error with -Z minimal-versions
taiki-e Jul 10, 2023
4bbd20d
Implemented `TryStreamExt::try_ready_chunks` (#2757)
DzenanJupic Jul 19, 2023
36581d6
docs: futures-util::StreamExt: cite map and then in docs (#2756)
marcospb19 Jul 19, 2023
247e1f0
Add `len`, `is_empty` methods for `UnboundedSender` (#2750)
thement Jul 25, 2023
b65bbdf
Fix typo (it's/its) in join_all docs (#2766)
adamchalmers Aug 1, 2023
652ec46
Update CI config (#2768)
taiki-e Aug 5, 2023
c3748e5
Fix rustdoc::redundant_explicit_links warning (#2769)
taiki-e Aug 23, 2023
2ad0d31
Fix typo (#2770)
Aug 24, 2023
7b68b15
Remove an outdated comment from docs (#2774)
WaffleLapkin Sep 25, 2023
75f6f84
Update `FuturesOrdered` docs to refer to `poll_next` instead of `poll`
zachs18 Oct 9, 2023
d02e01f
Add doclinks to `FuturesOrdered`'s docs.
zachs18 Oct 9, 2023
486189d
Wrap doc comments in futures_ordered.rs
zachs18 Oct 9, 2023
d551d42
Panic if `All` or `Any` are polled after completing due to a short-ci…
cstyles Oct 21, 2023
5724e31
Replace `All` and `Any`'s `accum` field with `done`
cstyles Oct 21, 2023
13afcc8
Add tests for `StreamExt::all` and `StreamExt::any`
cstyles Oct 22, 2023
c9ee75c
Fix unused_imports warning
taiki-e Oct 25, 2023
c6e0092
Fix infinite loop caused by invalid UTF-8 bytes
newca12 Oct 24, 2023
6ce97ff
Extend io::AsyncBufReadExt::lines example with invalid UTF-8
newca12 Oct 25, 2023
38085db
Fix Sync impl of FuturesUnordered
taiki-e Oct 26, 2023
49f24bb
Remove unsafe code from AssertUnmoved
taiki-e Oct 26, 2023
56835c0
Add `TryAll` adapter
cstyles Oct 21, 2023
cb8d168
Add `TryAny` adapter
cstyles Oct 21, 2023
9d7f4e4
Provide AtomicWaker if portable-atomic feature is enabled, even if at…
taiki-e Oct 26, 2023
863baed
Release 0.3.29
taiki-e Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 40 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,36 @@ concurrency:

jobs:
test:
name: cargo test (${{ matrix.os }})
name: cargo test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
- os: ubuntu-latest
target: armv5te-unknown-linux-gnueabi
- os: ubuntu-latest
target: i686-unknown-linux-gnu
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update nightly --no-self-update && rustup default nightly
- run: cargo test --workspace --all-features
- run: cargo test --workspace --all-features --release

cross:
name: cargo test --target ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- i686-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update nightly && rustup default nightly
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- run: cargo test --target ${{ matrix.target }} --workspace --all-features $DOCTEST_XCOMPILE
- run: cargo test --target ${{ matrix.target }} --workspace --all-features --release $DOCTEST_XCOMPILE
if: matrix.target != ''
- run: cargo test --workspace --all-features $DOCTEST_XCOMPILE
- run: cargo test --workspace --all-features --release $DOCTEST_XCOMPILE
# TODO: https://github.com/rust-lang/futures-rs/issues/2451
if: matrix.target != 'aarch64-unknown-linux-gnu'

core-msrv:
name: cargo +${{ matrix.rust }} build (futures-{core, io, sink})
Expand All @@ -77,7 +71,7 @@ jobs:
- '1.36'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
# cargo does not support for --features/--no-default-features with workspace, so use cargo-hack instead.
Expand Down Expand Up @@ -111,7 +105,7 @@ jobs:
- '1.56'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cargo-hack
Expand All @@ -127,7 +121,8 @@ jobs:
# Check std feature
- run: cargo hack build --workspace --ignore-private --no-default-features --features std --ignore-unknown-features
# Check compat feature (futures, futures-util)
- run: cargo hack build -p futures -p futures-util --no-default-features --features std,io-compat
# Exclude io-compat feature because the MSRV when it is enabled depends on the MSRV of tokio 0.1.
- run: cargo hack build -p futures -p futures-util --no-default-features --features std,compat
# Check thread-pool feature (futures, futures-executor)
- run: cargo hack build -p futures -p futures-executor --no-default-features --features std,thread-pool

Expand All @@ -142,7 +137,7 @@ jobs:
- nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cargo-hack
Expand All @@ -151,18 +146,17 @@ jobs:
- run: cargo build --tests --features default,thread-pool,io-compat --manifest-path futures/Cargo.toml

minimal-versions:
name: cargo build -Z minimal-versions
name: cargo minimal-versions build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
# remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
- run: cargo hack --remove-dev-deps --workspace
- run: cargo update -Z minimal-versions
- run: cargo build --workspace --all-features
- name: Install cargo-minimal-versions
uses: taiki-e/install-action@cargo-minimal-versions
- run: cargo minimal-versions build --workspace --ignore-private --all-features

no-std:
name: cargo build --target ${{ matrix.target }}
Expand All @@ -176,7 +170,7 @@ jobs:
- thumbv6m-none-eabi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: rustup target add ${{ matrix.target }}
Expand Down Expand Up @@ -208,7 +202,7 @@ jobs:
name: cargo bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: cargo bench --workspace
Expand All @@ -218,7 +212,7 @@ jobs:
name: cargo hack check --feature-powerset
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- name: Install cargo-hack
Expand All @@ -243,7 +237,7 @@ jobs:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: ci/no_atomic_cas.sh
Expand All @@ -260,7 +254,7 @@ jobs:
echo "::set-output name=success::false"
fi
if: github.repository_owner == 'rust-lang' && github.event_name == 'schedule'
- uses: peter-evans/create-pull-request@v3
- uses: peter-evans/create-pull-request@v5
with:
title: Update no_atomic_cas.rs
body: |
Expand All @@ -276,7 +270,7 @@ jobs:
name: cargo miri test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup toolchain install nightly --component miri && rustup default nightly
- run: cargo miri test --workspace --all-features
Expand All @@ -295,10 +289,9 @@ jobs:
- thread
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: rustup component add rust-src
run: rustup toolchain install nightly --component rust-src && rustup default nightly
- run: cargo -Z build-std test --workspace --all-features --target x86_64-unknown-linux-gnu --lib --tests
env:
# TODO: Once `cfg(sanitize = "..")` is stable, replace
Expand All @@ -312,7 +305,7 @@ jobs:
# name: cargo clippy
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - name: Install Rust
# run: rustup toolchain install nightly --component clippy && rustup default nightly
# - run: cargo clippy --workspace --all-features --all-targets
Expand All @@ -321,7 +314,7 @@ jobs:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- run: cargo fmt --all -- --check
Expand All @@ -330,7 +323,7 @@ jobs:
name: cargo doc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo doc --workspace --no-deps --all-features
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: github.repository_owner == 'rust-lang'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 0.3.29 - 2023-10-26

* Add `TryStreamExt::try_ready_chunks` (#2757)
* Add `TryStreamExt::{try_all,try_any}` (#2783)
* Add `UnboundedSender::{len,is_empty}` (#2750)
* Fix `Sync` impl of `FuturesUnordered` (#2788)
* Fix infinite loop caused by invalid UTF-8 bytes (#2785)
* Fix build error with -Z minimal-versions (#2761)

# 0.3.28 - 2023-03-30

* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
Expand Down
6 changes: 3 additions & 3 deletions futures-channel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "futures-channel"
version = "0.3.28"
version = "0.3.29"
edition = "2018"
rust-version = "1.56"
license = "MIT OR Apache-2.0"
Expand All @@ -22,8 +22,8 @@ unstable = []
cfg-target-has-atomic = []

[dependencies]
futures-core = { path = "../futures-core", version = "0.3.28", default-features = false }
futures-sink = { path = "../futures-sink", version = "0.3.28", default-features = false, optional = true }
futures-core = { path = "../futures-core", version = "0.3.29", default-features = false }
futures-sink = { path = "../futures-sink", version = "0.3.29", default-features = false, optional = true }

[dev-dependencies]
futures = { path = "../futures", default-features = true }
Expand Down
27 changes: 20 additions & 7 deletions futures-channel/src/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,27 @@ impl<T> Unpin for BoundedSenderInner<T> {}

/// The transmission end of a bounded mpsc channel.
///
/// This value is created by the [`channel`](channel) function.
/// This value is created by the [`channel`] function.
pub struct Sender<T>(Option<BoundedSenderInner<T>>);

/// The transmission end of an unbounded mpsc channel.
///
/// This value is created by the [`unbounded`](unbounded) function.
/// This value is created by the [`unbounded`] function.
pub struct UnboundedSender<T>(Option<UnboundedSenderInner<T>>);

trait AssertKinds: Send + Sync + Clone {}
impl AssertKinds for UnboundedSender<u32> {}

/// The receiving end of a bounded mpsc channel.
///
/// This value is created by the [`channel`](channel) function.
/// This value is created by the [`channel`] function.
pub struct Receiver<T> {
inner: Option<Arc<BoundedInner<T>>>,
}

/// The receiving end of an unbounded mpsc channel.
///
/// This value is created by the [`unbounded`](unbounded) function.
/// This value is created by the [`unbounded`] function.
pub struct UnboundedReceiver<T> {
inner: Option<Arc<UnboundedInner<T>>>,
}
Expand Down Expand Up @@ -343,9 +343,8 @@ impl SenderTask {
/// guaranteed slot in the channel capacity, and on top of that there are
/// `buffer` "first come, first serve" slots available to all senders.
///
/// The [`Receiver`](Receiver) returned implements the
/// [`Stream`](futures_core::stream::Stream) trait, while [`Sender`](Sender) implements
/// `Sink`.
/// The [`Receiver`] returned implements the [`Stream`] trait, while [`Sender`]
/// implements `Sink`.
pub fn channel<T>(buffer: usize) -> (Sender<T>, Receiver<T>) {
// Check that the requested buffer size does not exceed the maximum buffer
// size permitted by the system.
Expand Down Expand Up @@ -842,6 +841,20 @@ impl<T> UnboundedSender<T> {
let ptr = self.0.as_ref().map(|inner| inner.ptr());
ptr.hash(hasher);
}

/// Return the number of messages in the queue or 0 if channel is disconnected.
pub fn len(&self) -> usize {
if let Some(sender) = &self.0 {
decode_state(sender.inner.state.load(SeqCst)).num_messages
} else {
0
}
}

/// Return false is channel has no queued messages, true otherwise.
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}

impl<T> Clone for Sender<T> {
Expand Down
18 changes: 9 additions & 9 deletions futures-channel/src/oneshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ use crate::lock::Lock;

/// A future for a value that will be provided by another asynchronous task.
///
/// This is created by the [`channel`](channel) function.
/// This is created by the [`channel`] function.
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Receiver<T> {
inner: Arc<Inner<T>>,
}

/// A means of transmitting a single value to another task.
///
/// This is created by the [`channel`](channel) function.
/// This is created by the [`channel`] function.
pub struct Sender<T> {
inner: Arc<Inner<T>>,
}
Expand Down Expand Up @@ -332,8 +332,8 @@ impl<T> Sender<T> {
/// Completes this oneshot with a successful result.
///
/// This function will consume `self` and indicate to the other end, the
/// [`Receiver`](Receiver), that the value provided is the result of the
/// computation this represents.
/// [`Receiver`], that the value provided is the result of the computation
/// this represents.
///
/// If the value is successfully enqueued for the remote end to receive,
/// then `Ok(())` is returned. If the receiving end was dropped before
Expand All @@ -343,7 +343,7 @@ impl<T> Sender<T> {
}

/// Polls this `Sender` half to detect whether its associated
/// [`Receiver`](Receiver) has been dropped.
/// [`Receiver`] has been dropped.
///
/// # Return values
///
Expand All @@ -359,10 +359,10 @@ impl<T> Sender<T> {
}

/// Creates a future that resolves when this `Sender`'s corresponding
/// [`Receiver`](Receiver) half has hung up.
/// [`Receiver`] half has hung up.
///
/// This is a utility wrapping [`poll_canceled`](Sender::poll_canceled)
/// to expose a [`Future`](core::future::Future).
/// to expose a [`Future`].
pub fn cancellation(&mut self) -> Cancellation<'_, T> {
Cancellation { inner: self }
}
Expand Down Expand Up @@ -413,8 +413,8 @@ impl<T> Future for Cancellation<'_, T> {
}
}

/// Error returned from a [`Receiver`](Receiver) when the corresponding
/// [`Sender`](Sender) is dropped.
/// Error returned from a [`Receiver`] when the corresponding [`Sender`] is
/// dropped.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct Canceled;

Expand Down
Loading