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

Commit 235ff17

Browse files
authored
Merge pull request #125 from TheBlueMatt/master
Revert "don't export core"
2 parents 98aa44c + e257592 commit 235ff17

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
# 0.9.6 - 2021-05-03
3+
4+
* Re-export `core` as `_export::_core`. This resolves an issue when calling several exported macros with the `std` feature.
5+
26
# 0.9.5 - 2021-04-28
37

48
* Add [`#[repr(transparent)]` to all newtype wrappers](https://github.com/rust-bitcoin/bitcoin_hashes/pull/108/)

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bitcoin_hashes"
3-
version = "0.9.5"
3+
version = "0.9.6"
44
authors = ["Andrew Poelstra <[email protected]>"]
55
license = "CC0-1.0"
66
description = "Hash functions used by rust-bitcoin which support rustc 1.29.0"

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
#[cfg(feature="serde")] pub extern crate serde;
4242
#[cfg(all(test,feature="serde"))] extern crate serde_test;
4343

44+
#[doc(hidden)]
45+
pub mod _export {
46+
/// A re-export of ::core::*
47+
pub mod _core {
48+
pub use ::core::*;
49+
}
50+
}
51+
4452
#[cfg(feature = "schemars")] extern crate schemars;
4553

4654
#[macro_use] mod util;

src/util.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ macro_rules! hex_fmt_impl(
2929
hex_fmt_impl!($imp, $ty, );
3030
);
3131
($imp:ident, $ty:ident, $($gen:ident: $gent:ident),*) => (
32-
impl<$($gen: $gent),*> ::core::fmt::$imp for $ty<$($gen),*> {
33-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
32+
impl<$($gen: $gent),*> $crate::_export::_core::fmt::$imp for $ty<$($gen),*> {
33+
fn fmt(&self, f: &mut $crate::_export::_core::fmt::Formatter) -> $crate::_export::_core::fmt::Result {
3434
use $crate::hex::{format_hex, format_hex_reverse};
3535
if $ty::<$($gen),*>::DISPLAY_BACKWARD {
3636
format_hex_reverse(&self.0, f)
@@ -49,37 +49,37 @@ macro_rules! index_impl(
4949
index_impl!($ty, );
5050
);
5151
($ty:ident, $($gen:ident: $gent:ident),*) => (
52-
impl<$($gen: $gent),*> ::core::ops::Index<usize> for $ty<$($gen),*> {
52+
impl<$($gen: $gent),*> $crate::_export::_core::ops::Index<usize> for $ty<$($gen),*> {
5353
type Output = u8;
5454
fn index(&self, index: usize) -> &u8 {
5555
&self.0[index]
5656
}
5757
}
5858

59-
impl<$($gen: $gent),*> ::core::ops::Index<::core::ops::Range<usize>> for $ty<$($gen),*> {
59+
impl<$($gen: $gent),*> $crate::_export::_core::ops::Index<$crate::_export::_core::ops::Range<usize>> for $ty<$($gen),*> {
6060
type Output = [u8];
61-
fn index(&self, index: ::core::ops::Range<usize>) -> &[u8] {
61+
fn index(&self, index: $crate::_export::_core::ops::Range<usize>) -> &[u8] {
6262
&self.0[index]
6363
}
6464
}
6565

66-
impl<$($gen: $gent),*> ::core::ops::Index<::core::ops::RangeFrom<usize>> for $ty<$($gen),*> {
66+
impl<$($gen: $gent),*> $crate::_export::_core::ops::Index<$crate::_export::_core::ops::RangeFrom<usize>> for $ty<$($gen),*> {
6767
type Output = [u8];
68-
fn index(&self, index: ::core::ops::RangeFrom<usize>) -> &[u8] {
68+
fn index(&self, index: $crate::_export::_core::ops::RangeFrom<usize>) -> &[u8] {
6969
&self.0[index]
7070
}
7171
}
7272

73-
impl<$($gen: $gent),*> ::core::ops::Index<::core::ops::RangeTo<usize>> for $ty<$($gen),*> {
73+
impl<$($gen: $gent),*> $crate::_export::_core::ops::Index<$crate::_export::_core::ops::RangeTo<usize>> for $ty<$($gen),*> {
7474
type Output = [u8];
75-
fn index(&self, index: ::core::ops::RangeTo<usize>) -> &[u8] {
75+
fn index(&self, index: $crate::_export::_core::ops::RangeTo<usize>) -> &[u8] {
7676
&self.0[index]
7777
}
7878
}
7979

80-
impl<$($gen: $gent),*> ::core::ops::Index<::core::ops::RangeFull> for $ty<$($gen),*> {
80+
impl<$($gen: $gent),*> $crate::_export::_core::ops::Index<$crate::_export::_core::ops::RangeFull> for $ty<$($gen),*> {
8181
type Output = [u8];
82-
fn index(&self, index: ::core::ops::RangeFull) -> &[u8] {
82+
fn index(&self, index: $crate::_export::_core::ops::RangeFull) -> &[u8] {
8383
&self.0[index]
8484
}
8585
}
@@ -93,19 +93,19 @@ macro_rules! borrow_slice_impl(
9393
borrow_slice_impl!($ty, );
9494
);
9595
($ty:ident, $($gen:ident: $gent:ident),*) => (
96-
impl<$($gen: $gent),*> ::core::borrow::Borrow<[u8]> for $ty<$($gen),*> {
96+
impl<$($gen: $gent),*> $crate::_export::_core::borrow::Borrow<[u8]> for $ty<$($gen),*> {
9797
fn borrow(&self) -> &[u8] {
9898
&self[..]
9999
}
100100
}
101101

102-
impl<$($gen: $gent),*> ::core::convert::AsRef<[u8]> for $ty<$($gen),*> {
102+
impl<$($gen: $gent),*> $crate::_export::_core::convert::AsRef<[u8]> for $ty<$($gen),*> {
103103
fn as_ref(&self) -> &[u8] {
104104
&self[..]
105105
}
106106
}
107107

108-
impl<$($gen: $gent),*> ::core::ops::Deref for $ty<$($gen),*> {
108+
impl<$($gen: $gent),*> $crate::_export::_core::ops::Deref for $ty<$($gen),*> {
109109
type Target = [u8];
110110

111111
fn deref(&self) -> &Self::Target {
@@ -241,14 +241,14 @@ macro_rules! hash_newtype {
241241
}
242242
}
243243

244-
impl ::core::convert::From<$hash> for $newtype {
244+
impl $crate::_export::_core::convert::From<$hash> for $newtype {
245245
fn from(inner: $hash) -> $newtype {
246246
// Due to rust 1.22 we have to use this instead of simple `Self(inner)`
247247
Self { 0: inner }
248248
}
249249
}
250250

251-
impl ::core::convert::From<$newtype> for $hash {
251+
impl $crate::_export::_core::convert::From<$newtype> for $hash {
252252
fn from(hashtype: $newtype) -> $hash {
253253
hashtype.0
254254
}
@@ -290,9 +290,9 @@ macro_rules! hash_newtype {
290290
}
291291
}
292292

293-
impl ::core::str::FromStr for $newtype {
293+
impl $crate::_export::_core::str::FromStr for $newtype {
294294
type Err = $crate::hex::Error;
295-
fn from_str(s: &str) -> ::core::result::Result<$newtype, Self::Err> {
295+
fn from_str(s: &str) -> $crate::_export::_core::result::Result<$newtype, Self::Err> {
296296
$crate::hex::FromHex::from_hex(s)
297297
}
298298
}

0 commit comments

Comments
 (0)