Repository navigation
refactor: pre-0.8.1 internal simplifications and Miri coverage - #461
Merged
Merged
Conversation
`spmc::BoundedSender<T>` is not `Clone` and both `send` and `reserve` hold `&mut self` across waiting and any returned `Permit`, so at most one sender waiter can ever exist for a queue. Keeping a `WaitList<RetryWaiter>` allocated an arena on first backpressure and duplicated waiting and cancellation glue across separate `Send` and `Reserve` futures. Store the blocked sender waker in `Option<Waker>` and route `Shared::send` through `reserve().await` and `send_reserved`, matching `mpsc` and `mpmc`. Signed-off-by: tison <wander4096@gmail.com>
`OnceMap` and `singleflight::Group` maintained near-identical copies of their `HashTable<Arc<Entry<K, V>>>` lookup, duplicate-key drop ordering, and abandoned-entry reference-count cleanup logic. Both also dismissed their cleanup guard only after cloning `V`, causing an unnecessary table lock acquisition if `V::clone` panicked after publication. Extract `internal::coalesce` (`Entry`, `EntryTable`, and `EntryGuard`) and check `!entry.cell.initialized()` before acquiring the table lock in `EntryGuard::drop`. Signed-off-by: tison <wander4096@gmail.com>
Since `WaitGroup` moved onto its own state machine, `internal::countdown` was gated behind `feature = "latch"` with `Latch` as its only caller and a 1:1 forwarding wrapper. Inline `CountdownState` and its wait future directly into `latch`. Signed-off-by: tison <wander4096@gmail.com>
…batch Every caller of `OnceState::complete_mut` holds `&mut self` across a preceding `reset_mut`, so `HAS_WAITERS` can never be set when completing exclusively. In `internal::semaphore`, checking `waiters.is_empty()` at the start of `distribute_permits` avoids constructing a `WakerBatch` on uncontended slow-path releases and collapses the duplicate branch in `cancel_acquire`. Signed-off-by: tison <wander4096@gmail.com>
`cargo x miri` launched a separate Cargo invocation per integration test binary and omitted `barrier_test`, `completion_test`, `event_test`, `pool_test` (including its `cfg!(miri)` replenish test), and `traits_test`. `tests-integration` also enabled `tokio/full`, pulling `mio`/`kqueue` into `#[tokio::test]` binaries and breaking Miri on macOS. Convert the three synchronous `pool_test` cases to plain `#[test]`, narrow `tests-integration`'s Tokio features to the runtime, sync, time, and macro subsets it uses, batch all Miri integration targets into one invocation, pass `--all-features` directly in `cargo x test`, and align the `semver` subcommand name in `dislopify`. Signed-off-by: tison <wander4096@gmail.com>
`shutdown_test` spawned detached futures onto a global multi-threaded `test_runtime()` without ensuring they parked before `request_shutdown`, leaving `tokio` in regular `[dependencies]` and keeping `shutdown_test` out of Miri. Meanwhile, `broadcast_test::unbounded` dropped a woken `recv` future without polling it for `RecvError::Disconnected`, and `event_test::manual_reset::ReentrantWaker` called `reset()` in both `wake` and `drop` so a missed wake callback still passed via `Drop`. Drive `shutdown_test` deterministically with `TestTask` (and include it in `cargo x miri`), convert the remaining `mpsc` caller to `#[tokio::test]` so `test_runtime()` can be removed and `tokio` moved to `[dev-dependencies]`, poll the woken broadcast receiver for disconnection, and split wake and drop callbacks in `manual_reset`. Signed-off-by: tison <wander4096@gmail.com>
Update the getting-started Cargo snippet in `asyncband/src/lib.rs` from `0.7` to `0.8` (noting it in the release skill checklist) and drop the three `pool` files from `.asf.yaml`'s `source_excludes_lightweight` list to match `licenserc.toml` now that they carry standard ASF headers. Signed-off-by: tison <wander4096@gmail.com>
tisonkun
force-pushed
the
refactor/pre-0.8.1-dislopify
branch
from
November 23, 2026 02:31
5570659 to
66e5a2c
Compare
This file contains hidden or 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
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.
Summary
Clean up pre-
0.8.1internal redundancies, test/Miri blind spots, and release metadata on top ofDESIGN.mdwithout changing public APIs:spmcsender waiting (37b5130): ReplaceState::send_waiters: WaitList<RetryWaiter>withOption<Waker>and routeShared::sendthroughreserve().awaitandsend_reserved, matchingmpscandmpmcsinceBoundedSenderis!Cloneand holds&mut selfacross waiting and any returnedPermit.c62a87f): Extractinternal::coalesce(Entry,EntryTable, andEntryGuard) forOnceMapandsingleflight::Group, removing duplicated reference-count cleanup logic while preservingOnceMap's cached lookup fast path and skipping table-lock acquisition inEntryGuard::droponceentry.cell.initialized()is set.latchcountdown state (317883b): Inline single-consumerinternal::countdowndirectly intolatchnow thatWaitGroupuses its own state machine.OnceStateandSemaphorecleanup (702ffab): Replace the unreachableHAS_WAITERSwake branch inOnceState::complete_mutwith adebug_assert_eq!and hoistwaiters.is_empty()to the top ofSemaphore::distribute_permitsto skipWakerBatchsetup on empty queues and deduplicatecancel_acquire.xtaskrunner (7c2c9e7): Convert the three synchronouspool_testcases to plain#[test], narrowtests-integration's Tokio feature set to avoidmio/kqueueFFI crashes under macOS Miri, batch Miri integration targets into one Cargo invocation (addingbarrier_test,completion_test,event_test,pool_test, andtraits_test), and pass--all-featuresdirectly incargo x test.shutdown_testand wake assertions (deae323): Driveshutdown_testwithTestTask(and include it incargo x miri), removetests_integration::test_runtime()and movetokioto[dev-dependencies], poll the woken broadcast receiver forRecvError::Disconnected, and split wake vs drop callbacks inevent_test::manual_reset.66e5a2c): Update the getting-started Cargo snippet inasyncband/src/lib.rsfrom0.7to0.8(noting it in the release skill checklist) and drop the threepoolfiles from.asf.yaml'ssource_excludes_lightweightlist to matchlicenserc.toml.Validation
cargo x lintcargo x checkcargo x testcargo x miri(67 library unit tests + 17 integration test suites)cargo x semver --release-version 0.8.1(196/196 passed)--repeat 7..9on Apple M4 Max):spmc/bounded/tasks-1p4c-cap64-4w:304 msbaseline vs303 msPRprimitives::once_map::lookup::compute_hit_same_key/threads=1:130 msbaseline vs114 msPR