io: Replace gated no_std with blanket no_std
What changed, and why it matters
This is a routine internal cleanup in the Rust Bitcoin project. It changes how one small crate declares its relationship to the Rust standard library so that it matches the style used by other crates in the same repository. There is no security-relevant change here.
No security action required. Treat as normal maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit converts the io crate from conditional #![cfg_attr(not(feature = "std"), no_std)] to unconditional #![no_std], and adds #[cfg(feature = "std")] extern crate std; plus explicit std:: imports for Box, Vec, ToString, and vec when the std feature is enabled. This is a build/configuration refactor to make crate conventions uniform. No logic, API, or behavior changes are present in the diff.
Changed components
io/src/lib.rsio/src/error.rsInspect captured patch +10 / −1
diff --git a/io/src/error.rs b/io/src/error.rs
index 61a574d5..daad7732 100644
--- a/io/src/error.rs
+++ b/io/src/error.rs
@@ -2,6 +2,8 @@
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::boxed::Box;
+#[cfg(feature = "std")]
+use std::boxed::Box;
use core::fmt;
/// The `io` crate error type.
diff --git a/io/src/lib.rs b/io/src/lib.rs
index 57d3149f..d2bd0e0a 100644
--- a/io/src/lib.rs
+++ b/io/src/lib.rs
@@ -13,7 +13,7 @@
//! For examples of how to use and implement the types and traits in this crate see `io.rs` in the
//! `github.com/rust-bitcoin/rust-bitcoin/bitcoin/examples/` directory.
-#![cfg_attr(not(feature = "std"), no_std)]
+#![no_std]
// Coding conventions.
#![warn(missing_docs)]
#![doc(test(attr(warn(unused))))]
@@ -23,6 +23,9 @@
#[cfg(feature = "alloc")]
extern crate alloc;
+#[cfg(feature = "std")]
+extern crate std;
+
#[cfg(feature = "hashes")]
pub extern crate hashes;
@@ -35,6 +38,8 @@ mod hash;
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::vec::Vec;
+#[cfg(feature = "std")]
+use std::vec::Vec;
use core::cmp;
use encoding::{Decodable, Decoder, Encoder};
@@ -630,6 +635,8 @@ impl<D> From<Error> for ReadError<D> {
mod tests {
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::{string::ToString, vec};
+ #[cfg(feature = "std")]
+ use std::{string::ToString, vec};
use encoding::{ArrayDecoder, ArrayEncoder, UnexpectedEofError};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.