Replace archived core2 dependency with no_std_io2#185
Replace archived core2 dependency with no_std_io2#185vmx merged 2 commits intomultiformats:masterfrom
Conversation
core2 was archived upstream on 2026-04-14 ("No longer supported. Use
core directly."). core::io::{Read, Write} are not yet stable in Rust
(tracking issue rust-lang/rust#68315), so a direct migration is not
currently possible.
no_std_io2 0.8.1 is an API-compatible drop-in replacement for core2's
io module, purpose-built for crates that need the std::io trait shape
in no_std contexts.
This mirrors the approach taken in multiformats/rust-multihash#407
for multiformats org consistency.
Closes multiformats#184.
|
Note on CI: all 7 checks are failing with |
|
Could we make
|
That'd be a great improvement, I don't think there's a point in pulling this dependency for every project, especially given that I'd imagine most projects using this crate aren't restricted by |
|
Thanks @Benten-Ben for the PR. Could you please add a comment to #177. I still hope that license change eventually happens. |
@hanabi1224 That sounds good to me. But I first want to get this patch release with minimal changes out quickly. PRs are welcome to improve things in regards to std/no_std. |
Summary
core2was archived upstream on 2026-04-14 with the note "No longer supported. Usecoredirectly." Version 0.4.0 is yanked from crates.io with no replacement, makingcidcurrently unbuildable from a clean checkout against the default registry.This PR swaps
core2forno_std_io2, an API-compatible drop-in replacement purpose-built for crates that needstd::io's trait shape inno_stdcontexts.Approach
Mirrors the approach in multiformats/rust-multihash#407 for multiformats org consistency. The diff is the minimum needed:
Cargo.toml: replace thecore2dependency withno_std_io2 = "0.8.1"; update two feature flags (std,alloc) to referenceno_std_io2/allocinstead ofcore2/alloc.src/cid.rs,src/error.rs: replace the twouse core2::io;imports withuse no_std_io2::io;.No other changes.
no_std_io2'sio::Readandio::Errortypes preserve the exact surface previously consumed fromcore2::io.Alternatives considered
core::io::{Read, Write}: not stable (rust-lang/rust#68315 has been open since 2020, blocked on thestd::io::ErrorOS-coupling problem).embedded-io: more idiomatic for new work, but introduces a different trait surface and would be a larger, more opinionated change. Happy to rework asembedded-ioif maintainers prefer.rust-multihashmigration.Testing
Currently,
cid's own dev-dependency chain (multihash-codetable) pullscore2transitively, so the upstream test suite can't build against a clean registry until #407 merges and a release is cut. Once that lands, the test suite unblocks automatically.The library itself compiles cleanly against
no_std_io2for--all-features,--no-default-features, and--no-default-features --features alloc.Refs
Closes #184.