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.31 #2889

Merged
merged 29 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
99e1ceb
tests: Fix dead_code warning for tuple struct
taiki-e Jan 6, 2024
a2a53cd
Fix typos (#2821)
vuittont60 Jan 8, 2024
67660ae
Use [lints] in Cargo.toml
taiki-e Oct 5, 2024
dac5078
Use Self keyword instead of concrete type name
taiki-e Dec 24, 2023
657a010
Apply unsafe_op_in_unsafe_fn lint if available on MSRV
taiki-e Dec 24, 2023
c252b73
Always set #![no_std] and remove redundant imports
taiki-e Feb 25, 2024
696afc6
Ignore dead_code lint on Assert* traits
taiki-e Feb 25, 2024
a6f1c4e
Fix rustdoc::redundant_explicit_links warning
taiki-e Feb 25, 2024
070731d
Add 'static bound to waker_ref
taiki-e Feb 26, 2024
fc90d8e
Add test of select's grammar
dtolnay Feb 28, 2024
e594d2c
Parse rhs of `select!` arms using match-arm rules
dtolnay Feb 28, 2024
98e9091
Use *::MAX associated constants
taiki-e Mar 8, 2024
32bc43b
ci: Use taiki-e/checkout-action action
taiki-e Mar 8, 2024
0d65330
Add a helper for always ready futures (#2825)
GnomedDev Mar 9, 2024
17ecb89
Make non constructor methods of futures::io::{BufReader,BufWriter} no…
ethe Mar 31, 2024
a6e98bb
Remove unused direct dependency on pin-utils
taiki-e Apr 5, 2024
a080556
ci: Set timeout-minutes in all jobs
taiki-e May 2, 2024
a0fd391
Remove no longer needed `extern crate proc_macro`
taiki-e May 2, 2024
4ae1158
Tweak imports in tests
taiki-e May 2, 2024
343f2b3
Various fixes too make the CI green (#2885)
hkratz Sep 14, 2024
57fac08
Add missing symbols (#2883)
cuishuang Sep 14, 2024
721d7e6
Add accessors for the inner of stream::Iter (#2875)
wfraser Sep 14, 2024
0c0b39f
Use `#[inline(always)]` on `clone_arc_raw` (#2865)
timotheyca Sep 14, 2024
10f9fb9
Fix issues with `AsyncBufRead::read_line` and `AsyncBufReadExt::lines…
hkratz Sep 18, 2024
536fb22
ci: Work around sanitizer issue on latest Linux kernel
taiki-e Mar 17, 2024
a60174b
Fix use after free of task in FuturesUnordered when dropped future pa…
Imberflur Oct 3, 2024
9ffc284
Document how `BoxFuture`s / `BoxStream`s are often made (#2887)
alamb Oct 4, 2024
1112a45
Fix clippy::uninit_vec warning
taiki-e Oct 26, 2021
16c6b93
Release 0.3.31
taiki-e Oct 5, 2024
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
51 changes: 36 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ jobs:
- os: ubuntu-latest
target: i686-unknown-linux-gnu
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- 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
Expand All @@ -70,8 +71,9 @@ jobs:
# When updating this, the reminder to update the minimum required version in README.md and Cargo.toml.
- '1.36'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- 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 @@ -104,8 +106,9 @@ jobs:
# When updating this, the reminder to update the minimum required version in README.md and Cargo.toml.
- '1.56'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cargo-hack
Expand Down Expand Up @@ -136,8 +139,9 @@ jobs:
- beta
- nightly
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cargo-hack
Expand All @@ -148,8 +152,9 @@ jobs:
minimal-versions:
name: cargo minimal-versions build
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update nightly && rustup default nightly
- name: Install cargo-hack
Expand All @@ -169,8 +174,9 @@ jobs:
- thumbv7m-none-eabi
- thumbv6m-none-eabi
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: rustup target add ${{ matrix.target }}
Expand Down Expand Up @@ -201,8 +207,9 @@ jobs:
bench:
name: cargo bench
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: cargo bench --workspace
Expand All @@ -211,8 +218,9 @@ jobs:
features:
name: cargo hack check --feature-powerset
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update nightly && rustup default nightly
- name: Install cargo-hack
Expand All @@ -233,14 +241,21 @@ jobs:
miri:
name: cargo miri test
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup toolchain install nightly --component miri && rustup default nightly
- run: cargo miri test --workspace --all-features
- run: cargo miri test --workspace --all-features -- --skip panic_on_drop_fut
env:
MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-disable-isolation
RUSTFLAGS: ${{ env.RUSTFLAGS }} -Z randomize-layout
# This test is expected to leak.
- run: cargo miri test --workspace --all-features --test stream_futures_unordered -- panic_on_drop_fut
env:
MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-ignore-leaks
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -Z randomize-layout
RUSTFLAGS: ${{ env.RUSTFLAGS }} -Z randomize-layout

san:
name: cargo test -Z sanitizer=${{ matrix.sanitizer }}
Expand All @@ -252,11 +267,14 @@ jobs:
- memory
- thread
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
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
# https://github.com/google/sanitizers/issues/1716 / https://github.com/actions/runner-images/issues/9491
- run: sudo sysctl vm.mmap_rnd_bits=28
- run: cargo -Z build-std test --workspace --all-features --target x86_64-unknown-linux-gnu --lib --tests -- --skip panic_on_drop_fut
env:
# TODO: Once `cfg(sanitize = "..")` is stable, replace
# `cfg(futures_sanitizer)` with `cfg(sanitize = "..")` and remove
Expand All @@ -268,26 +286,29 @@ jobs:
# clippy:
# name: cargo clippy
# runs-on: ubuntu-latest
# timeout-minutes: 60
# steps:
# - uses: actions/checkout@v4
# - uses: taiki-e/checkout-action@v1
# - name: Install Rust
# run: rustup toolchain install nightly --component clippy && rustup default nightly
# - run: cargo clippy --workspace --all-features --all-targets

fmt:
name: cargo fmt
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- name: Install Rust
run: rustup update stable
- run: cargo fmt --all -- --check

docs:
name: cargo doc
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: taiki-e/checkout-action@v1
- 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@v4
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 0.3.31 - 2024-10-05

* Fix use after free of task in `FuturesUnordered` when dropped future panics (#2886)
* Fix soundness bug in `task::waker_ref` (#2830)
This is a breaking change but allowed because it is soundness bug fix.
* Fix bugs in `AsyncBufRead::read_line` and `AsyncBufReadExt::lines` (#2884)
* Fix parsing issue in `select!`/`select_biased!` (#2832)
This is technically a breaking change as it will now reject a very odd undocumented syntax that was previously accidentally accepted.
* Work around issue due to upstream `Waker::will_wake` change (#2865)
* Add `stream::Iter::{get_ref,get_mut,into_inner}` (#2875)
* Add `future::AlwaysReady` (#2825)
* Relax trait bound on non-constructor methods of `io::{BufReader,BufWriter}` (#2848)

# 0.3.30 - 2023-12-24

* Add `{BiLock,SplitStream,SplitSink,ReadHalf,WriteHalf}::is_pair_of` (#2797)
Expand Down
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ members = [
"examples/functional",
"examples/imperative",
]

[workspace.lints.rust]
missing_debug_implementations = "warn"
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unreachable_pub = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(futures_sanitizer)'] }
5 changes: 4 additions & 1 deletion examples/functional/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[package]
name = "futures-example-functional"
version = "0.0.0"
edition = "2018"
version = "0.1.0"
publish = false

[dependencies]
futures = { path = "../../futures", features = ["thread-pool"] }

[lints]
workspace = true
5 changes: 4 additions & 1 deletion examples/imperative/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[package]
name = "futures-example-imperative"
version = "0.0.0"
edition = "2018"
version = "0.1.0"
publish = false

[dependencies]
futures = { path = "../../futures", features = ["thread-pool"] }

[lints]
workspace = true
9 changes: 6 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.30"
version = "0.3.31"
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.30", default-features = false }
futures-sink = { path = "../futures-sink", version = "0.3.30", default-features = false, optional = true }
futures-core = { path = "../futures-core", version = "0.3.31", default-features = false }
futures-sink = { path = "../futures-sink", version = "0.3.31", default-features = false, optional = true }

[dev-dependencies]
futures = { path = "../futures", default-features = true }
Expand All @@ -32,3 +32,6 @@ futures-test = { path = "../futures-test", default-features = true }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true
12 changes: 4 additions & 8 deletions futures-channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,21 @@
//! All items are only available when the `std` or `alloc` feature of this
//! library is activated, and it is activated by default.

#![cfg_attr(not(feature = "std"), no_std)]
#![warn(
missing_debug_implementations,
missing_docs,
rust_2018_idioms,
single_use_lifetimes,
unreachable_pub
)]
#![no_std]
#![doc(test(
no_crate_inject,
attr(
deny(warnings, rust_2018_idioms, single_use_lifetimes),
allow(dead_code, unused_assignments, unused_variables)
)
))]
#![warn(missing_docs, unsafe_op_in_unsafe_fn)]

#[cfg_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;

#[cfg_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
#[cfg(feature = "alloc")]
Expand Down
5 changes: 3 additions & 2 deletions futures-channel/src/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ pub struct Sender<T>(Option<BoundedSenderInner<T>>);
/// This value is created by the [`unbounded`] function.
pub struct UnboundedSender<T>(Option<UnboundedSenderInner<T>>);

#[allow(dead_code)]
trait AssertKinds: Send + Sync + Clone {}
impl AssertKinds for UnboundedSender<u32> {}

Expand Down Expand Up @@ -302,13 +303,13 @@ struct State {
}

// The `is_open` flag is stored in the left-most bit of `Inner::state`
const OPEN_MASK: usize = usize::max_value() - (usize::max_value() >> 1);
const OPEN_MASK: usize = usize::MAX - (usize::MAX >> 1);

// When a new channel is created, it is created in the open state with no
// pending messages.
const INIT_STATE: usize = OPEN_MASK;

// The maximum number of messages that a channel can track is `usize::max_value() >> 1`
// The maximum number of messages that a channel can track is `usize::MAX >> 1`
const MAX_CAPACITY: usize = !(OPEN_MASK);

// The maximum requested buffer size must be less than the maximum capacity of
Expand Down
35 changes: 19 additions & 16 deletions futures-channel/src/mpsc/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

pub(super) use self::PopResult::*;

use std::boxed::Box;
use std::cell::UnsafeCell;
use std::ptr;
use std::sync::atomic::{AtomicPtr, Ordering};
Expand Down Expand Up @@ -113,22 +114,24 @@ impl<T> Queue<T> {
///
/// This function is unsafe because only one thread can call it at a time.
pub(super) unsafe fn pop(&self) -> PopResult<T> {
let tail = *self.tail.get();
let next = (*tail).next.load(Ordering::Acquire);

if !next.is_null() {
*self.tail.get() = next;
assert!((*tail).value.is_none());
assert!((*next).value.is_some());
let ret = (*next).value.take().unwrap();
drop(Box::from_raw(tail));
return Data(ret);
}
unsafe {
let tail = *self.tail.get();
let next = (*tail).next.load(Ordering::Acquire);

if !next.is_null() {
*self.tail.get() = next;
assert!((*tail).value.is_none());
assert!((*next).value.is_some());
let ret = (*next).value.take().unwrap();
drop(Box::from_raw(tail));
return Data(ret);
}

if self.head.load(Ordering::Acquire) == tail {
Empty
} else {
Inconsistent
if self.head.load(Ordering::Acquire) == tail {
Empty
} else {
Inconsistent
}
}
}

Expand All @@ -138,7 +141,7 @@ impl<T> Queue<T> {
/// This function is unsafe because only one thread can call it at a time.
pub(super) unsafe fn pop_spin(&self) -> Option<T> {
loop {
match self.pop() {
match unsafe { self.pop() } {
Empty => return None,
Data(t) => return Some(t),
// Inconsistent means that there will be a message to pop
Expand Down
4 changes: 2 additions & 2 deletions futures-channel/tests/mpsc-close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ fn stress_try_send_as_receiver_closes() {
}
impl TestTask {
/// Create a new TestTask
fn new() -> (TestTask, mpsc::Sender<TestRx>) {
fn new() -> (Self, mpsc::Sender<TestRx>) {
let (command_tx, command_rx) = mpsc::channel::<TestRx>(0);
(
TestTask {
Self {
command_rx,
test_rx: None,
countdown: 0, // 0 means no countdown is in progress.
Expand Down
1 change: 1 addition & 0 deletions futures-channel/tests/mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::thread;

#[allow(dead_code)]
trait AssertSend: Send {}
impl AssertSend for mpsc::Sender<i32> {}
impl AssertSend for mpsc::Receiver<i32> {}
Expand Down
5 changes: 4 additions & 1 deletion futures-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "futures-core"
version = "0.3.30"
version = "0.3.31"
edition = "2018"
rust-version = "1.36"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -29,3 +29,6 @@ futures = { path = "../futures" }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true
Loading