Repository navigation
Conversation
AppendOnlyVec only needs core and alloc. The one use of std is yielding to the operating system when a push has spun for a long time; that is now behind a default `std` feature, and without it the crate is no_std and always spins. An optional `portable-atomic` feature uses that crate's atomics, for targets such as thumbv6m-none-eabi that have no compare-and-swap. CI checks both no_std targets. This lets internment's `intern` feature, which uses AppendOnlyVec, build without std. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Define BITS_USED for 16-bit targets, which no_std makes reachable. - Saturate the spin_wait failure counter, since without std a waiter can spin long enough to overflow it on 32-bit targets. - Document that a no_std push must not preempt another push to the same vec (e.g. from an interrupt handler), and that std users who disable default features should re-enable std. - Run the tests in CI with std disabled, with and without portable-atomic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Instead of one function that mixes cfg! in its condition, a cfg attribute on the yield, and a min(3) that only the no_std path needs, define spin_wait once for each configuration. Behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split spin_wait into std and no_std versions
Resolve conflicts with #17 by keeping its allocation-failure and zero-sized-type handling, using core/alloc paths instead of std. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a job that checks the crate on msp430-none-elf, so the 16-bit BITS_USED setting is compiled. It is a tier 3 target, so it needs nightly and -Zbuild-std. The MSRV job ran cargo test on Rust 1.56, which builds the dev-dependencies, and parking_lot_core and libc now need 1.65+, so that job failed on main too. Check only the library there instead, with default, all, and no default features. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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
AppendOnlyVeconly needscoreandalloc; its one use ofstdwasstd::thread::yield_now()in the spin-wait. This makes the crateno_stdunless the new defaultstdfeature is on:std(default): unchanged behaviour, including yielding to the OS after a few failed spins.default-features = false:#![no_std]; the spin-wait always spins (there is no scheduler to yield to).portable-atomic(optional dependency, so an implicit feature): useportable_atomic::AtomicUsize, for targets without compare-and-swap such asthumbv6m-none-eabi. Those targets also need one of portable-atomic's features saying how to provide atomics (e.g.critical-section).Everything else is
std::→core::/alloc::paths. Default users see no change.Why
internment's
internandintern32features useAppendOnlyVec, and its CI checks them onx86_64-unknown-noneandthumbv6m-none-eabi, which fails with "can't find crate forstd" in this crate (see droundy/internment#66). After a release, internment can depend onappend-only-vecwithdefault-features = falseand forwardstd/portable-atomic.Test plan
cargo testandcargo test --no-default-features --features portable-atomic(stable)cargo check --libwith default,--no-default-features,--features portable-atomic, and both (stable)cargo +1.65.0 check --libwith and without default features (and withportable-atomic)Check without std:cargo check --no-default-featuresonx86_64-unknown-none, and onthumbv6m-none-eabiwithportable-atomic,portable-atomic/critical-section(I don't have these targets installed locally)Not included: the version bump and the release.
🤖 Generated with Claude Code