Skip to content

make crate no_std compatible#73

Merged
bmwill merged 5 commits into
masterfrom
no_std
Apr 20, 2026
Merged

make crate no_std compatible#73
bmwill merged 5 commits into
masterfrom
no_std

Conversation

@bmwill

@bmwill bmwill commented Apr 20, 2026

Copy link
Copy Markdown
Owner

No description provided.

@bmwill
bmwill force-pushed the no_std branch 3 times, most recently from 7e9760d to 4663482 Compare April 20, 2026 00:11
Brandon Williams added 5 commits April 19, 2026 19:45
Previously, the crate unconditionally depended on `std`. With this
commit, the crate is marked `#![no_std]` and uses `alloc` instead of
`std` for its core functionality. An opt-in `std` feature gates the
`io::Write`-based APIs (`Patch::to_bytes`, `PatchFormatter::write_*_into`)
and the `std::error::Error` impls on error types.

`HashMap` usage is now sourced from `hashbrown` rather than
`std::collections` so line classification works without `std`.

Tests now require `--all-features` to run since they exercise the
`std`-gated APIs and rely on `alloc` prelude imports.
Enable the `std_instead_of_core`, `std_instead_of_alloc`, and
`alloc_instead_of_core` clippy restriction lints so accidental reliance
on `std::` in `no_std` code paths is caught at lint time.
Previously, nothing in CI proved the crate actually works in `no_std`
environments — a desktop `cargo build` with `std` omitted from features
still resolves `std` through the target's sysroot. With this commit,
add a dedicated job that builds against `aarch64-unknown-none`, a
bare-metal target without any `std` crate, so any accidental `std`
reliance fails to link.

The job builds both the default configuration and `--features color`
to cover the feature matrix that is expected to work without `std`.
@bmwill
bmwill merged commit 304eb6f into master Apr 20, 2026
42 checks passed
@bmwill
bmwill deleted the no_std branch April 20, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant