Add symlink to shared include to each crate
What changed, and why it matters
This commit adds symbolic links (shortcuts that point to another folder) inside each Rust crate to a shared 'include' directory at the workspace root, and updates source code to use these symlinks. It is a build/packaging fix so that code shared across crates can be found when the crates are published individually to crates.io. There is no security-relevant change here.
No security action required. Reviewers may want to confirm that the symlinks are preserved correctly on Windows checkouts and by Cargo when packaging, but this is a normal build maintenance concern.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch creates relative symlinks named ‘include’ in bitcoin/, hashes/, io/, primitives/, and units/ pointing to ../include, and changes include!(“../../include/…”) paths to include!(“../include/…”). This ensures the included files reside within each crate directory, satisfying Cargo’s requirement that published crates only contain files under their own directory. The included files themselves are unchanged.
Changed components
bitcoin/include symlinkhashes/include symlinkio/include symlinkprimitives/include symlinkunits/include symlinkinclude! macro paths in bitcoin, hashes, io, primitives, units cratesInspect captured patch +14 / −9
diff --git a/bitcoin/include b/bitcoin/include
new file mode 120000
index 00000000..f5030fe8
--- /dev/null
+++ b/bitcoin/include
@@ -0,0 +1 @@
+../include
\ No newline at end of file
diff --git a/bitcoin/src/internal_macros.rs b/bitcoin/src/internal_macros.rs
index 7d4471f3..d3fd16d6 100644
--- a/bitcoin/src/internal_macros.rs
+++ b/bitcoin/src/internal_macros.rs
@@ -44,7 +44,7 @@ macro_rules! impl_consensus_encoding {
pub(crate) use impl_consensus_encoding;
// Pull in shared impl_array_newtype_stringify macro from include
-include!("../../include/array_newtype.rs");
+include!("../include/array_newtype.rs");
#[rustfmt::skip]
macro_rules! impl_asref_push_bytes {
diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs
index 8919d396..2d867315 100644
--- a/bitcoin/src/lib.rs
+++ b/bitcoin/src/lib.rs
@@ -79,7 +79,7 @@ pub extern crate serde;
mod internal_macros;
-include!("../../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
+include!("../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
pub mod ext {
//! Re-export all the extension traits so downstream can use wildcard imports.
diff --git a/bitcoin/src/pow.rs b/bitcoin/src/pow.rs
index fbfd5e35..858fb0d7 100644
--- a/bitcoin/src/pow.rs
+++ b/bitcoin/src/pow.rs
@@ -409,7 +409,7 @@ impl U256Wrapper for Work {
fn from_inner(inner: U256) -> Self { Self::from_le_bytes(inner.to_le_bytes()) }
}
-include!("../../include/u256.rs");
+include!("../include/u256.rs");
macro_rules! impl_hex {
($hex:path, $case:expr) => {
diff --git a/hashes/include b/hashes/include
new file mode 120000
index 00000000..f5030fe8
--- /dev/null
+++ b/hashes/include
@@ -0,0 +1 @@
+../include
\ No newline at end of file
diff --git a/hashes/src/lib.rs b/hashes/src/lib.rs
index 4d7839cf..cc23231b 100644
--- a/hashes/src/lib.rs
+++ b/hashes/src/lib.rs
@@ -308,7 +308,7 @@ pub fn debug_hex<'a>(
Ok(())
}
-include!("../../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
+include!("../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
#[cfg(test)]
mod tests {
diff --git a/io/include b/io/include
new file mode 120000
index 00000000..f5030fe8
--- /dev/null
+++ b/io/include
@@ -0,0 +1 @@
+../include
\ No newline at end of file
diff --git a/io/src/lib.rs b/io/src/lib.rs
index 8212135e..ac0d77ee 100644
--- a/io/src/lib.rs
+++ b/io/src/lib.rs
@@ -650,7 +650,7 @@ impl<D> From<Error> for ReadError<D> {
}
#[cfg(feature = "std")]
-include!("../../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
+include!("../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
#[cfg(test)]
mod tests {
diff --git a/primitives/include b/primitives/include
new file mode 120000
index 00000000..f5030fe8
--- /dev/null
+++ b/primitives/include
@@ -0,0 +1 @@
+../include
\ No newline at end of file
diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs
index b0e0a2a9..650c79a1 100644
--- a/primitives/src/lib.rs
+++ b/primitives/src/lib.rs
@@ -129,5 +129,5 @@ pub(crate) fn compact_size_encode(value: usize) -> ArrayVec<u8, 9> {
}
#[cfg(feature = "alloc")]
-include!("../../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
-include!("../../include/decoder_newtype.rs"); // decoder_newtype! macro
+include!("../include/newtype.rs"); // Explained in `REPO_DIR/docs/README.md`.
+include!("../include/decoder_newtype.rs"); // decoder_newtype! macro
diff --git a/units/include b/units/include
new file mode 120000
index 00000000..f5030fe8
--- /dev/null
+++ b/units/include
@@ -0,0 +1 @@
+../include
\ No newline at end of file
diff --git a/units/src/lib.rs b/units/src/lib.rs
index 2b305276..4cb6bae0 100644
--- a/units/src/lib.rs
+++ b/units/src/lib.rs
@@ -85,4 +85,4 @@ pub type BlockInterval = BlockHeightInterval;
// decoder_newtype! macro
#[cfg(feature = "encoding")]
-include!("../../include/decoder_newtype.rs");
+include!("../include/decoder_newtype.rs");
diff --git a/units/src/pow.rs b/units/src/pow.rs
index c34b7b8a..85351727 100644
--- a/units/src/pow.rs
+++ b/units/src/pow.rs
@@ -412,7 +412,7 @@ impl<'a> Arbitrary<'a> for CompactTarget {
}
}
-include!("../../include/u256.rs");
+include!("../include/u256.rs");
impl U256 {
/// Constructs a new `U256` from a prefixed hex string.
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.