Skip to content

Commit 264e703

Browse files
ADD-SPDarksonn
authored andcommitted
Merge tokio-1.43.4 into tokio-1.47.x (#7822)
2 parents 3762a6a + dfb0f00 commit 264e703

File tree

7 files changed

+33
-6
lines changed

7 files changed

+33
-6
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'master' || $CIRRUS_BRANCH =~ 'tokio-.*')
22
auto_cancellation: $CIRRUS_BRANCH != 'master' && $CIRRUS_BRANCH !=~ 'tokio-.*'
33
freebsd_instance:
4-
image_family: freebsd-14-2
4+
image_family: freebsd-14-3
55
env:
66
RUST_STABLE: stable
77
RUST_NIGHTLY: nightly-2025-01-25

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,21 +1078,21 @@ jobs:
10781078
run: cargo test -p tokio --target ${{ matrix.target }} --features full
10791079
env:
10801080
CARGO_TARGET_WASM32_WASIP1_RUNNER: "wasmtime run --"
1081-
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -S threads=y --"
1081+
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -W shared-memory=y -S threads=y --"
10821082
RUSTFLAGS: --cfg tokio_unstable -Dwarnings -C target-feature=+atomics,+bulk-memory -C link-args=--max-memory=67108864
10831083

10841084
- name: WASI test tokio-util full
10851085
run: cargo test -p tokio-util --target ${{ matrix.target }} --features full
10861086
env:
10871087
CARGO_TARGET_WASM32_WASIP1_RUNNER: "wasmtime run --"
1088-
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -S threads=y --"
1088+
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -W shared-memory=y -S threads=y --"
10891089
RUSTFLAGS: --cfg tokio_unstable -Dwarnings -C target-feature=+atomics,+bulk-memory -C link-args=--max-memory=67108864
10901090

10911091
- name: WASI test tokio-stream
10921092
run: cargo test -p tokio-stream --target ${{ matrix.target }} --features time,net,io-util,sync
10931093
env:
10941094
CARGO_TARGET_WASM32_WASIP1_RUNNER: "wasmtime run --"
1095-
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -S threads=y --"
1095+
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -W shared-memory=y -S threads=y --"
10961096
RUSTFLAGS: --cfg tokio_unstable -Dwarnings -C target-feature=+atomics,+bulk-memory -C link-args=--max-memory=67108864
10971097

10981098
- name: test tests-integration --features wasi-rt
@@ -1109,7 +1109,7 @@ jobs:
11091109
if: matrix.target == 'wasm32-wasip1-threads'
11101110
working-directory: tests-integration
11111111
env:
1112-
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -S threads=y --"
1112+
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -W shared-memory=y -S threads=y --"
11131113
RUSTFLAGS: --cfg tokio_unstable -Dwarnings -C target-feature=+atomics,+bulk-memory -C link-args=--max-memory=67108864
11141114

11151115
check-external-types:

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tokio/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,14 @@ comment on [#7172].
263263
[#7186]: https://github.com/tokio-rs/tokio/pull/7186
264264
[#7192]: https://github.com/tokio-rs/tokio/pull/7192
265265

266+
# 1.43.4 (January 3rd, 2026)
267+
268+
### Fixed
269+
270+
* sync: return `TryRecvError::Disconnected` from `Receiver::try_recv` after `Receiver::close` ([#7686])
271+
272+
[#7686]: https://github.com/tokio-rs/tokio/pull/7686
273+
266274
# 1.43.3 (October 14th, 2025)
267275

268276
### Fixed

tokio/src/sync/mpsc/chan.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ impl<T, S: Semaphore> Rx<T, S> {
439439
return Ok(value);
440440
}
441441
TryPopResult::Closed => return Err(TryRecvError::Disconnected),
442+
// If close() was called, an empty queue should report Disconnected.
443+
TryPopResult::Empty if rx_fields.rx_closed => {
444+
return Err(TryRecvError::Disconnected)
445+
}
442446
TryPopResult::Empty => return Err(TryRecvError::Empty),
443447
TryPopResult::Busy => {} // fall through
444448
}

tokio/src/sync/mpsc/list.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ pub(crate) enum TryPopResult<T> {
3535
/// Successfully popped a value.
3636
Ok(T),
3737
/// The channel is empty.
38+
///
39+
/// Note that `list.rs` only tracks the close state set by senders. If the
40+
/// channel is closed by `Rx::close()`, then `TryPopResult::Empty` is still
41+
/// returned, and the close state needs to be handled by `chan.rs`.
3842
Empty,
3943
/// The channel is empty and closed.
44+
///
45+
/// Returned when the send half is closed (all senders dropped).
4046
Closed,
4147
/// The channel is not empty, but the first value is being written.
4248
Busy,

tokio/tests/sync_mpsc.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,15 @@ fn try_recv_unbounded() {
966966
}
967967
}
968968

969+
#[test]
970+
fn try_recv_after_receiver_close() {
971+
let (_tx, mut rx) = mpsc::channel::<()>(5);
972+
973+
assert_eq!(Err(TryRecvError::Empty), rx.try_recv());
974+
rx.close();
975+
assert_eq!(Err(TryRecvError::Disconnected), rx.try_recv());
976+
}
977+
969978
#[test]
970979
fn try_recv_close_while_empty_bounded() {
971980
let (tx, mut rx) = mpsc::channel::<()>(5);

0 commit comments

Comments
 (0)