Skip to content

Commit 54855ba

Browse files
authored
fix: replace archived core2 dependency with no_std_io2 (#185)
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. The dependencies that also had this `no_std_io2` change were also explicitly updated to the corresponding versions. Closes #184.
1 parent ed3658f commit 54855ba

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ rust-version = "1.81"
1212

1313
[features]
1414
default = ["std"]
15-
std = ["alloc", "core2/alloc", "multihash/std", "unsigned-varint/std"]
16-
alloc = ["dep:multibase", "core2/alloc", "multihash/alloc"]
15+
std = ["alloc", "no_std_io2/alloc", "multihash/std", "unsigned-varint/std"]
16+
alloc = ["dep:multibase", "no_std_io2/alloc", "multihash/alloc"]
1717
arb = ["dep:arbitrary", "dep:quickcheck", "dep:rand", "multihash/arb"]
1818
scale-codec = ["dep:parity-scale-codec", "multihash/scale-codec"]
1919
serde-codec = ["serde"] # Deprecated, don't use.
2020
serde = ["alloc", "dep:serde", "dep:serde_bytes", "multihash/serde"]
2121

2222
[dependencies]
23-
multihash = { version = "0.19.0", default-features = false }
23+
multihash = { version = "0.19.4", default-features = false }
2424
unsigned-varint = { version = "0.8.0", default-features = false }
2525

2626
multibase = { version = "0.9.1", optional = true, default-features = false }
@@ -31,9 +31,9 @@ serde = { version = "1.0.116", default-features = false, optional = true }
3131
serde_bytes = { version = "0.11.5", default-features = false, features = ["alloc"], optional = true }
3232
arbitrary = { version = "1.1.0", optional = true }
3333

34-
core2 = { version = "0.4", default-features = false }
34+
no_std_io2 = { version = "0.8.1", default-features = false }
3535

3636
[dev-dependencies]
37-
multihash-derive = { version = "0.9.0", default-features = false }
37+
multihash-derive = { version = "0.9.2", default-features = false }
3838
serde_json = { version = "1.0.59", default-features = false, features = ["alloc"]}
39-
multihash-codetable = { version = "0.1.0", default-features = false, features = ["sha2"] }
39+
multihash-codetable = { version = "0.2.1", default-features = false, features = ["sha2"] }

src/cid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(crate) fn varint_read_u64<R: io::Read>(mut r: R) -> Result<u64> {
5151
use std::io;
5252

5353
#[cfg(not(feature = "std"))]
54-
use core2::io;
54+
use no_std_io2::io;
5555

5656
use crate::error::{Error, Result};
5757
use crate::version::Version;

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use core::fmt;
44
use std::io;
55

66
#[cfg(not(feature = "std"))]
7-
use core2::io;
7+
use no_std_io2::io;
88

99
/// Type alias to use this library's [`Error`] type in a `Result`.
1010
pub type Result<T> = core::result::Result<T, Error>;

0 commit comments

Comments
 (0)