units: Remove _unchecked parsing function
What changed, and why it matters
This commit removes a helper function from the public API of a Rust Bitcoin library. The function was never intended for outside use and only parses hex numbers that have no '0x' prefix. Making it private reduces the library's exposed surface, which is a good defensive practice, but there is no evidence it fixed an active security bug.
No immediate action required. Treat as routine API cleanup. If you maintain code using this now-private function, migrate to the supported prefixed, non-prefixed, or 'any' parsing APIs.
Security signals we found
Reduction of public API surface
Removal of function requiring preconditions from public visibility
No input validation changes inside the function
Evidence from the diff
The change changes visibility of the macro-generated unchecked hex parsing function from pub to private (fn) in units/src/parse_int.rs. The commit message states the function is a helper that should not be public because callers must first ensure there is no ‘0x’ prefix. The library already exposes prefixed, non-prefixed, and ‘any’ variants. This is an API-hardening change, not a patch for a disclosed vulnerability.
Changed components
units/src/parse_int.rsMacro-generated unchecked hex parsing helperInspect captured patch +1 / −1
diff --git a/units/src/parse_int.rs b/units/src/parse_int.rs
index fe859b81..08c3f5d4 100644
--- a/units/src/parse_int.rs
+++ b/units/src/parse_int.rs
@@ -310,7 +310,7 @@ macro_rules! parse_hex_for {
#[doc = stringify!($int_type)]
#[doc = "`."]
#[inline]
- pub fn $uncheck_hex_fn(s: &str) -> Result<$int_type, ParseIntError> {
+ fn $uncheck_hex_fn(s: &str) -> Result<$int_type, ParseIntError> {
<$int_type>::from_str_radix(s, 16).map_err(|error| ParseIntError {
input: s.into(),
bits: $bits,
Why this scored 18/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.