roadmap PARTIAL

1141. intrusive_queue: the release review's findings

The release review of partsfoundry/intrusive_queue at commit 7368a9e3, under milestone 1129 (the combine review), whose block sets its form. Its baseline is milestone 1097 (what an outside maintainer would fix), its block, every finding of which has landed, and the cleared package notes/crate-reviews/intrusive-queue.md. The Unqueued token, the Send bound and the seven ratified names stand; the one thing reopened is the shape of the Node trait, on Miri evidence 1097 did not have.

Reuse: the prior-art table weighs each intrusive list a caller could take instead.

Finding status

Open decisions

One-way doors D1 and D2 below, for the architect, ruled together.

Goal

A stranger choosing between this crate, intrusive-collections and cordyceps finds the fastest queue at what it does, with the traits people expect of a collection. Its Node trait has a shape under which a later release can let a caller hold a reference to a queued node, which the 0.1.0 contract still forbids.

What the review read and ran

The commands, the Miri runs, the benchmark source and the comparators read are in the appendix. The 54 API Guidelines items are in the guidelines table.

Prior art

Measured from the crates.io API on 2026-11-26 (UTC).

crate role version read total 90 days reverse dependencies updated
intrusive-collections ranked 1 0.10.3 28,464,134 10,097,123 52 2026-08-04
cordyceps ranked 2 0.3.5 10,946,186 5,014,427 12 2026-07-29
pin-list ranked 3 0.1.2 1,491,602 1,441,663 5 2025-03-27
heapless neighbor: owning fixed-capacity queues 0.9.4 192,279,070 64,375,866 1236 2026-11-18

No integration crate applies: the traits a queue meets are the standard library's.

What intrusive_queue does better

The items

Effort is S (half a day), M (a day or two) or L (longer). A door is one-way when someone outside the repository acts on it after 0.1.0. Every P0 is a one-way change, so it lands in 0.1.0 or never.

P0: the 0.1.0 interface

P0-1. set_next takes the whole node by &mut

Verified with Miri (nightly, 2026-10-31), on the six programs in the appendix. Node::set_next(&mut self, ...) makes the queue form a unique reference to the whole node on every push. A caller that holds &(*node).id, a shared reference to a field that is not the link, across push_back has undefined behavior under Stacked Borrows. Miri reports the reference "later invalidated ... by a Unique function-entry retag" at the queue's set_next call. Tree Borrows accepts the same program.

A trait that projects by raw pointer to a bare Option<NonNull<Self>> field keeps that field reference valid under both models. It does not keep a reference to the whole node valid: a &Job held while the queue writes the link through the projection is undefined behavior under both. cordyceps 0.3.5 is not that shape. Its Linked::links returns NonNull<Links<T>>, and Links wraps its pointers in an UnsafeCell (src/list.rs, lines 231 to 232). A queue that projects to an opaque Link<T> of its own, private fields around an UnsafeCell, passes the whole-node program under both models.

Rule 3 of Unqueued::new already forbids every program here that holds a reference across a queue operation, so none of them shows a bug in the crate as documented. The finding is that the current trait can never relax that rule. A &mut self method retags the whole node whatever the documentation says. Under the opaque link, a later release can narrow rule 3 to "no reference to the link" and break no caller. Milestone 1097 weighed the reference-free shape (its item 5) and kept this one, on the argument that a held &mut breaks the aliasing rules under either shape. That holds for a &mut to the whole node. A shared reference survives only when the link sits in a cell; intrusive-collections keeps its links in Cells to the same end. Change: unsafe fn link(this: NonNull<Self>) -> NonNull<Link<Self>>, where Link<T> is the crate's own type with its field private and inside an UnsafeCell, and the queue reaches every link through it. Rule 3 stays as written for 0.1.0. Door: one-way (D1, ruled with D2). Effort: M, with the harnesses and the patches.

P1: before the first release

P1-1. Iter has no Debug, Clone or exact size

Verified in source (C-DEBUG, C-COMMON-TRAITS). Queue and Unqueued print; the walk does not, and a caller cannot clone it to walk twice. intrusive-collections 0.10.3's Iter is Clone, and cordyceps 0.3.5's is an ExactSizeIterator; neither prints. The queue keeps its length, so this walk can report it too. Change: Debug, Clone and ExactSizeIterator on Iter. Door: two-way. Effort: S.

P2: may follow

P2-1. The standard collection traits

Verified in source (C-COLLECT). There is no Extend<Unqueued<T>>, no FromIterator<Unqueued<T>> and no IntoIterator for &Queue. cordyceps 0.3.5 implements all three. Change: add them. Door: two-way. Effort: S.

P2-2. front and append

Verified in source. A caller cannot look at the head without popping it, or join two queues in constant time; cordyceps has front and append, and intrusive-collections has front and a cursor's splice_after. Change: front(&self) -> Option<NonNull<T>> and append(&mut self, &mut Queue<T>), names provisional. Door: two-way. Effort: S.

P2-3. Sync when T: Sync

Verified in source (C-SEND-SYNC). &Queue offers only is_empty, len and iter, which yields pointers; it would be sound to share. cordyceps is Sync for T: Sync. Change: the implementation, with a compile-fail doctest as the Send bound has. Door: two-way. Effort: S.

P2-4. The examples unwrap

Verified in source (C-QUESTION-MARK). Each example unwraps NonNull::new and pop_front. Change: examples that return a Result or an Option and use ?. Door: two-way. Effort: S.

P2-5. The bound on the struct declarations

Verified in source (C-STRUCT-BOUNDS). Queue<T: Node> and Iter<'a, T: Node> bound the type parameter where the fields need no bound. Change: move the bound to the impl blocks. Door: two-way, since removing a bound breaks no caller. Effort: S.

P2-6. Removal in constant time

Measured (below). remove walks from the head, as its documentation and the BUGS section state. Taking the node at the back of 1024 costs about 1,300 ns here against 1.5 ns in intrusive-collections and 3 ns in cordyceps, whose lists are doubly linked. A caller that removes often wants a doubly linked type. Change: a separate doubly linked type when a caller asks, beside this one. Door: two-way (an addition). Effort: L.

Measured performance

Run on a Linux x86_64 host with rustc 1.100.0, cargo build --release && ./target/release/iq_bench, twice, each figure the best of five passes timed with std::time::Instant. Every node is its own heap allocation, and each step reads one field of the node it moves. The source is in the appendix.

operation intrusive_queue intrusive-collections cordyceps
pop the front and push it back, 1024 nodes, per step 1.71 ns, 1.48 ns 2.53 ns, 2.31 ns 3.36 ns, 3.02 ns
remove one node and push it back, 1024 nodes, per step 1312.85 ns, 1286.81 ns 1.59 ns, 1.49 ns 2.97 ns, 2.97 ns

After the first removal the node sits at the back, so the second row is this crate's worst case.

One-way doors

Follow-on

Done when

The P0 and P1 findings read Done, or Will not fix with its ruling, the architect has ruled D1 and D2, and script/review-status shows the block BUILT.

BUGS

Index row

The release review of intrusive_queue against intrusive-collections, cordyceps and pin-list: the Node trait's shape as one P0 on Miri evidence, Iter's traits, five additions, and a benchmark where this queue leads on push and pop and trails on removal.