What changed, and why it matters
This commit is a routine internal code cleanup. It moves a compile-time assertion helper macro from a dedicated 'macros' file into the main library file and deletes the now-empty macros file. There is no user-facing behavior change and no security relevance.
No action needed. This is a non-security refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes internals/src/macros.rs and moves the const_assert! macro into internals/src/lib.rs. The macro implementation is unchanged: it still produces a const _: () block that panics at compile time if the boolean expression is false. This is purely a refactor of where the macro lives in the codebase.
Changed components
internals/src/lib.rsinternals/src/macros.rsInspect captured patch +13 / −17
diff --git a/internals/src/lib.rs b/internals/src/lib.rs
index daa04c0a..ff539e52 100644
--- a/internals/src/lib.rs
+++ b/internals/src/lib.rs
@@ -39,10 +39,22 @@ pub mod _export {
pub mod array;
pub mod array_vec;
pub mod error;
-pub mod macros;
pub mod script;
pub mod slice;
#[cfg(feature = "serde")]
#[macro_use]
pub mod serde;
pub mod const_casts;
+
+/// Asserts a boolean expression at compile time.
+#[macro_export]
+macro_rules! const_assert {
+ ($x:expr $(; $message:expr)?) => {
+ const _: () = {
+ if !$x {
+ // We can't use formatting in const, only concatenating literals.
+ panic!(concat!("assertion ", stringify!($x), " failed" $(, ": ", $message)?))
+ }
+ };
+ }
+}
diff --git a/internals/src/macros.rs b/internals/src/macros.rs
deleted file mode 100644
index c6e491db..00000000
--- a/internals/src/macros.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// SPDX-License-Identifier: CC0-1.0
-
-//! Various macros used by the Rust Bitcoin ecosystem.
-
-/// Asserts a boolean expression at compile time.
-#[macro_export]
-macro_rules! const_assert {
- ($x:expr $(; $message:expr)?) => {
- const _: () = {
- if !$x {
- // We can't use formatting in const, only concatenating literals.
- panic!(concat!("assertion ", stringify!($x), " failed" $(, ": ", $message)?))
- }
- };
- }
-}
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.