Skip to content

Replace archived core2 dependency with no_std_io2#185

Merged
vmx merged 2 commits intomultiformats:masterfrom
BentenAI:replace-core2-with-no-std-io2
Apr 15, 2026
Merged

Replace archived core2 dependency with no_std_io2#185
vmx merged 2 commits intomultiformats:masterfrom
BentenAI:replace-core2-with-no-std-io2

Conversation

@Benten-Ben
Copy link
Copy Markdown
Contributor

Summary

core2 was archived upstream on 2026-04-14 with the note "No longer supported. Use core directly." Version 0.4.0 is yanked from crates.io with no replacement, making cid currently unbuildable from a clean checkout against the default registry.

This PR swaps core2 for no_std_io2, an API-compatible drop-in replacement purpose-built for crates that need std::io's trait shape in no_std contexts.

Approach

Mirrors the approach in multiformats/rust-multihash#407 for multiformats org consistency. The diff is the minimum needed:

  • Cargo.toml: replace the core2 dependency with no_std_io2 = "0.8.1"; update two feature flags (std, alloc) to reference no_std_io2/alloc instead of core2/alloc.
  • src/cid.rs, src/error.rs: replace the two use core2::io; imports with use no_std_io2::io;.

No other changes. no_std_io2's io::Read and io::Error types preserve the exact surface previously consumed from core2::io.

Alternatives considered

  • core::io::{Read, Write}: not stable (rust-lang/rust#68315 has been open since 2020, blocked on the std::io::Error OS-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 as embedded-io if maintainers prefer.
  • Vendored internal shim: minimal diff but leaves the org inconsistent with the rust-multihash migration.

Testing

Currently, cid's own dev-dependency chain (multihash-codetable) pulls core2 transitively, 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_io2 for --all-features, --no-default-features, and --no-default-features --features alloc.

Refs

Closes #184.

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.
@Benten-Ben
Copy link
Copy Markdown
Contributor Author

Note on CI: all 7 checks are failing with error: failed to select a version for the requirement 'core2 = "^0.4.0"' (version 0.4.0 is yanked), which is the pre-existing breakage on master that issue #184 tracks and that this PR begins resolving. The remaining chain is multihash-codetable -> core2, which #407 addresses. Once #407 merges and the multihash crates are released, rust-cid's test suite should go green on this PR (plus possibly a matching dev-dep version bump to multihash-codetable = "0.2").

@hanabi1224
Copy link
Copy Markdown
Contributor

hanabi1224 commented Apr 15, 2026

Could we make no_std_io2 optional and only opt-in when no_std feature is enabled? That is to say,

  • when std is enabled, use std traits
  • when no_std is enabled, use no_std_io2 traits
  • when neither is enabled, skip implementing Write

@LesnyRumcajs
Copy link
Copy Markdown

Could we make no_std_io2 optional and only opt-in when no_std feature is enabled?

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 no_std.

@vmx
Copy link
Copy Markdown
Member

vmx commented Apr 15, 2026

Thanks @Benten-Ben for the PR. Could you please add a comment to #177. I still hope that license change eventually happens.

@vmx
Copy link
Copy Markdown
Member

vmx commented Apr 15, 2026

Could we make no_std_io2 optional and only opt-in when no_std feature is enabled? That is to say,

@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.

@vmx vmx merged commit 54855ba into multiformats:master Apr 15, 2026
8 checks passed
Benten-Ben added a commit to BentenAI/benten-engine that referenced this pull request Apr 22, 2026
Establishes the Phase 1 Cargo workspace for the Benten Engine:
benten-core, benten-graph, benten-ivm, benten-caps, benten-eval,
benten-engine, plus bindings/napi. This commit lands the workspace
manifest, lockfile, clippy configuration, and the three stub crates
(benten-ivm / benten-caps / benten-eval) whose real implementations
come online in subsequent phases. benten-core / benten-graph /
benten-engine / bindings-napi follow in their own slices.

Workspace dependencies are pinned to the 2026-04-14 validated versions
(ENGINE-SPEC §14.5): blake3 1.8, serde_ipld_dagcbor 0.6, multihash 0.19,
redb 4, napi 3, wasmtime 35, criterion 0.8, proptest 1.11, papaya 0.2,
mimalloc 0.1, thiserror 2, tracing 0.1.

Includes two [patch.crates-io] entries resolving the core2 yank
(bbqsrc/core2 archived 2026-04-14):
  - cid -> BentenAlignmentInc/rust-cid @ e11cf45 (our fork; upstream
    PR multiformats/rust-cid#185, tracking #184)
  - core2 -> technocreatives/core2 @ 545e84b (transitional; removed
    when multiformats/rust-multihash#407 merges and releases)

Clippy config adopts workspace-wide warn-on-all + pedantic + nursery
defaults with a Benten-specific doc-valid-idents allowlist (CIDv1,
MVCC, IVM, UCAN, DID, etc.) so Benten terms don't need backticks in
every doc line.
Benten-Ben added a commit to BentenAI/benten-engine that referenced this pull request Apr 22, 2026
Captures the Phase 1 stack-validation spike findings per the
pre-work process defined in CLAUDE.md Step 4:

- Verdict: STACK VALIDATED — 6-crate workspace composes end-to-end
  with deterministic content hashing
- What shipped: all 10 brief deliverables checked off (workspace
  scaffold, benten-core hashing, benten-graph KVBackend + redb,
  benten-engine orchestrator, napi bindings, criterion benchmark,
  cargo fmt/clippy/nextest/doc all green, D1 intra-process + D2
  cross-process + D3 wasm32 compile-check all passing)
- What was punted: multihash crate declared but not imported
  (hand-rolled envelope works), hand-rolled base32 (migrate to
  multibase crate), IVM/Caps/Eval crates as stubs, Node.js-side
  napi smoke test, mimalloc/papaya/wasmtime not yet wired
- Canonical CID pinned: bafyr4iflzldgzjrtknevsib24ewiqgtj65pm2ituow3yxfpq57nfmwduda
- Benchmark numbers with honest caveats (create_node 4.02ms driven
  by redb fsync — motivates Phase 1 DurabilityMode work)
- Seven surprises documented including the core2 yank + resolution:
  forked rust-cid to BentenAlignmentInc, swapped core2 -> no_std_io2,
  filed upstream PR multiformats/rust-cid#185
- Next actions numbered so any agent can pick them up
Benten-Ben added a commit to BentenAI/benten-engine that referenced this pull request Apr 22, 2026
Consolidates docs/ into a three-tier structure:
  docs/                — active, committed canonical docs
  docs/research/       — ongoing investigations (ivm-benchmark lives here)
  docs/validation/     — empirical artifacts (paper-prototype-handlers.md)
  docs/future/         — exploratory proposals (runtime, bentend, etc.)
  docs/archive/        — superseded specs + v1 critiques (read-only history)

New canonical docs produced during pre-work and critic review:
  VISION.md            — three-pillar framing, 8-phase committed scope
  ARCHITECTURE.md      — layered architecture, 6-crate Phase 1 plan
  QUICKSTART.md        — target 10-minute DX path (Phase 1 deliverable)
  ERROR-CATALOG.md     — stable error codes with fix hints
  GLOSSARY.md          — Benten-specific terms with definitions
  PROJECT-HISTORY.md   — how we got here, philosophy, naming
  DEVELOPMENT-METHODOLOGY.md — ADDL pipeline + orchestration patterns
  FULL-ROADMAP.md      — 8-phase committed plan + exploratory partition

Updated in place to reflect validated decisions (2026-04-14):
  BUSINESS-PLAN.md     — three pillars framing replaces three products
  DSL-SPECIFICATION.md — revised 12-primitive set (added SUBSCRIBE,
                         STREAM; dropped VALIDATE, GATE)
  ENGINE-SPEC.md       — 6-crate structure, validated deps, honest
                         performance targets, core2/no_std_io2 note
  PLATFORM-DESIGN.md   — unchanged in substance, formatting pass

Moves that previously sat as uncommitted deletes + untracked recreations:
  docs/archive-v{1,2}-* -> docs/archive/superseded/v{1,2}-specification.md
  docs/critique-*.md    -> docs/archive/v1-critiques/*
  docs/explore-*.md     -> docs/archive/superseded/ or docs/research/
  docs/operation-vocab-*.md / docs/review-vocab-* / docs/v2-review-*
                        -> docs/archive/superseded/ as applicable
  docs/paper-prototype-handlers.md -> docs/validation/
  prototypes/ivm/       -> docs/research/ivm-benchmark/

SPIKE follow-up: ENGINE-SPEC §7 gains a "Dependency note (2026-04-14)"
paragraph documenting the core2 yank and the BentenAlignmentInc
rust-cid fork pinning, pointing at multiformats/rust-cid#185.

CLAUDE.md is intentionally not included here — it is a high-traffic
orchestrator-facing file and gets its own separate slice (next commit).
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.

Dependency core2@0.4.0 yanked

5 participants