What changed, and why it matters
This commit raises the minimum supported Rust compiler version for the `internals` crate from 1.63 to 1.74 and removes old conditional compilation workarounds. It is a routine maintenance change with no security-relevant behavior change.
No security action required. Ensure CI and documentation reflect the new MSRV of 1.74.0.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch updates internals/Cargo.toml rust-version from 1.63.0 to 1.74.0, updates the rust_version! macro documentation example, and removes cond_const! fallbacks in array_vec.rs and rust_version! branches in io/src/bridge.rs. The removed branches were compatibility shims for older compilers; the new code relies on features stabilized in Rust 1.64+ (const slice::from_raw_parts) and 1.72/1.73+ (?Sized trait impls and additional std trait impls). No logic changes that affect runtime behavior, parsing, cryptography, or memory safety under the new MSRV.
Changed components
internals/Cargo.tomlinternals/build.rsinternals/src/array_vec.rsio/src/bridge.rsInspect captured patch +32 / −61
diff --git a/internals/Cargo.toml b/internals/Cargo.toml
index 68e8f012..633acf4f 100644
--- a/internals/Cargo.toml
+++ b/internals/Cargo.toml
@@ -10,7 +10,7 @@ categories = ["cryptography::cryptocurrencies", "no-std"]
keywords = ["internal"]
readme = "README.md"
edition = "2021"
-rust-version = "1.63.0"
+rust-version = "1.74.0"
exclude = ["tests", "contrib"]
[features]
diff --git a/internals/build.rs b/internals/build.rs
index fff95c4b..a8407015 100644
--- a/internals/build.rs
+++ b/internals/build.rs
@@ -51,10 +51,10 @@ fn write_macro(mut macro_file: impl io::Write, msrv_minor: u64, minor: u64) -> i
writeln!(macro_file, "/// Example:")?;
writeln!(macro_file, "/// ```")?;
writeln!(macro_file, "/// bitcoin_internals::rust_version! {{")?;
- writeln!(macro_file, "/// if >= 1.70 {{")?;
- writeln!(macro_file, "/// println!(\"This is Rust 1.70+\");")?;
+ writeln!(macro_file, "/// if >= 1.78 {{")?;
+ writeln!(macro_file, "/// println!(\"This is Rust 1.78+\");")?;
writeln!(macro_file, "/// }} else {{")?;
- writeln!(macro_file, "/// println!(\"This is Rust < 1.70\");")?;
+ writeln!(macro_file, "/// println!(\"This is Rust < 1.78\");")?;
writeln!(macro_file, "/// }}")?;
writeln!(macro_file, "/// }}")?;
writeln!(macro_file, "/// ```")?;
diff --git a/internals/src/array_vec.rs b/internals/src/array_vec.rs
index 830ba598..c0a036d8 100644
--- a/internals/src/array_vec.rs
+++ b/internals/src/array_vec.rs
@@ -12,8 +12,6 @@ pub use safety_boundary::ArrayVec;
mod safety_boundary {
use core::mem::MaybeUninit;
- use crate::const_tools::cond_const;
-
/// A growable contiguous collection backed by array.
#[derive(Copy)]
pub struct ArrayVec<T: Copy, const CAP: usize> {
@@ -43,14 +41,11 @@ mod safety_boundary {
Self { len: slice.len(), data }
}
- // from_raw_parts is const-unstable until 1.64
- cond_const! {
- /// Returns a reference to the underlying data.
- #[allow(clippy::incompatible_msrv)] // Clippy doesn't play nicely with `cond_const!`.
- pub const(in 1.64) fn as_slice(&self) -> &[T] {
- let ptr = &self.data as *const _ as *const T;
- unsafe { core::slice::from_raw_parts(ptr, self.len) }
- }
+ /// Returns a reference to the underlying data.
+ #[allow(clippy::incompatible_msrv)] // Clippy doesn't play nicely with `cond_const!`.
+ pub const fn as_slice(&self) -> &[T] {
+ let ptr = &self.data as *const _ as *const T;
+ unsafe { core::slice::from_raw_parts(ptr, self.len) }
}
/// Returns a mutable reference to the underlying data.
diff --git a/io/src/bridge.rs b/io/src/bridge.rs
index f82a8720..52a47694 100644
--- a/io/src/bridge.rs
+++ b/io/src/bridge.rs
@@ -253,40 +253,20 @@ macro_rules! impl_our {
};
}
-rust_version! {
- if >= 1.72 {
- impl_our! {
- impl<R: std::io::Read> Read for std::io::BufReader<R> where R: ?Sized
- }
-
- impl_our! {
- impl<R: std::io::Read> BufRead for std::io::BufReader<R> where R: ?Sized
- }
-
- impl_our! {
- impl<W: std::io::Write> Write for std::io::BufWriter<W> where W: ?Sized
- }
-
- impl_our! {
- impl<W: std::io::Write> Write for std::io::LineWriter<W> where W: ?Sized
- }
- } else {
- impl_our! {
- impl<R: std::io::Read> Read for std::io::BufReader<R>
- }
+impl_our! {
+ impl<R: std::io::Read> Read for std::io::BufReader<R> where R: ?Sized
+}
- impl_our! {
- impl<R: std::io::Read> BufRead for std::io::BufReader<R>
- }
+impl_our! {
+ impl<R: std::io::Read> BufRead for std::io::BufReader<R> where R: ?Sized
+}
- impl_our! {
- impl<W: std::io::Write> Write for std::io::BufWriter<W>
- }
+impl_our! {
+ impl<W: std::io::Write> Write for std::io::BufWriter<W> where W: ?Sized
+}
- impl_our! {
- impl<W: std::io::Write> Write for std::io::LineWriter<W>
- }
- }
+impl_our! {
+ impl<W: std::io::Write> Write for std::io::LineWriter<W> where W: ?Sized
}
impl std::io::Write for super::Sink {
@@ -344,25 +324,21 @@ impl_our! {
impl BufRead for std::io::Empty
}
-rust_version! {
- if >= 1.73 {
- impl_our! {
- impl Write for std::io::Empty
- }
+impl_our! {
+ impl Write for std::io::Empty
+}
- // No idea why &Empty impls Write but not Read + BufRead
- impl_our! {
- impl Write for &'_ std::io::Empty
- }
+// No idea why &Empty impls Write but not Read + BufRead
+impl_our! {
+ impl Write for &'_ std::io::Empty
+}
- impl_our! {
- impl Read for std::sync::Arc<std::fs::File>
- }
+impl_our! {
+ impl Read for std::sync::Arc<std::fs::File>
+}
- impl_our! {
- impl Write for std::sync::Arc<std::fs::File>
- }
- }
+impl_our! {
+ impl Write for std::sync::Arc<std::fs::File>
}
impl_our! {
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.