Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit aba33d1

Browse files
committed
Fix macro usage in macros
Currently we have macros that call other macros without a fully qualified path, this breaks some usage of the macros downstream because macro calls that should be opaque require importing. Fix macro usage in macros by using `$crate::` fully qualified path.
1 parent a7e3ff6 commit aba33d1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/sha256t.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ macro_rules! sha256t_hash_newtype {
162162
}
163163
}
164164

165-
hash_newtype!($newtype, $crate::sha256t::Hash<$tag>, 32, $docs, $reverse);
165+
$crate::hash_newtype!($newtype, $crate::sha256t::Hash<$tag>, 32, $docs, $reverse);
166166
};
167167
}
168168

src/util.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ macro_rules! circular_lshift64 (
2626
/// Adds hexadecimal formatting implementation of a trait `$imp` to a given type `$ty`.
2727
macro_rules! hex_fmt_impl(
2828
($imp:ident, $ty:ident) => (
29-
hex_fmt_impl!($imp, $ty, );
29+
$crate::hex_fmt_impl!($imp, $ty, );
3030
);
3131
($imp:ident, $ty:ident, $($gen:ident: $gent:ident),*) => (
3232
impl<$($gen: $gent),*> $crate::_export::_core::fmt::$imp for $ty<$($gen),*> {
@@ -48,7 +48,7 @@ macro_rules! hex_fmt_impl(
4848
#[macro_export]
4949
macro_rules! borrow_slice_impl(
5050
($ty:ident) => (
51-
borrow_slice_impl!($ty, );
51+
$crate::borrow_slice_impl!($ty, );
5252
);
5353
($ty:ident, $($gen:ident: $gent:ident),*) => (
5454
impl<$($gen: $gent),*> $crate::_export::_core::borrow::Borrow<[u8]> for $ty<$($gen),*> {
@@ -171,19 +171,19 @@ define_le_to_array!(u64_to_array_le, u64, 8);
171171
#[macro_export]
172172
macro_rules! hash_newtype {
173173
($newtype:ident, $hash:ty, $len:expr, $docs:meta) => {
174-
hash_newtype!($newtype, $hash, $len, $docs, <$hash as $crate::Hash>::DISPLAY_BACKWARD);
174+
$crate::hash_newtype!($newtype, $hash, $len, $docs, <$hash as $crate::Hash>::DISPLAY_BACKWARD);
175175
};
176176
($newtype:ident, $hash:ty, $len:expr, $docs:meta, $reverse:expr) => {
177177
#[$docs]
178178
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
179179
#[repr(transparent)]
180180
pub struct $newtype($hash);
181181

182-
hex_fmt_impl!(Debug, $newtype);
183-
hex_fmt_impl!(Display, $newtype);
184-
hex_fmt_impl!(LowerHex, $newtype);
185-
serde_impl!($newtype, $len);
186-
borrow_slice_impl!($newtype);
182+
$crate::hex_fmt_impl!(Debug, $newtype);
183+
$crate::hex_fmt_impl!(Display, $newtype);
184+
$crate::hex_fmt_impl!(LowerHex, $newtype);
185+
$crate::serde_impl!($newtype, $len);
186+
$crate::borrow_slice_impl!($newtype);
187187

188188
impl $newtype {
189189
/// Creates this type from the inner hash type.

0 commit comments

Comments
 (0)