Skip to content

Commit 8ac0e60

Browse files
committed
Merge rust-bitcoin#3140: primitives: Fix alloc feature
3b5bcd0 primitives: Fix alloc feature (Tobin C. Harding) Pull request description: We have an `alloc` feature but we are unconditionally using `extern crate alloc`, this is broken - clearly we need to add a `no-std` build for `primitives` in CI. Feature gate the `alloc` crate. While we are at it just pull types in from `alloc` in the `prelude` - I have no idea why we do not do this in `bitcoin`? ACKs for top commit: Kixunil: ACK 3b5bcd0 apoelstra: ACK 3b5bcd0 successfully ran local tests Tree-SHA512: f042dfb368dc0bde16237764a0dd09def7eeeb59291a5dbb1b5bd5f1dcd49b3adf66c12508c3be4f0ff48b52cd31cbb20edea68d9d55760e99c506ac5b114781
2 parents bee044f + 3b5bcd0 commit 8ac0e60

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

primitives/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
1919
#![allow(clippy::needless_borrows_for_generic_args)] // https://github.com/rust-lang/rust-clippy/issues/12454
2020

21+
#[cfg(feature = "alloc")]
2122
extern crate alloc;
2223

2324
#[cfg(feature = "std")]
@@ -44,9 +45,6 @@ pub use self::sequence::Sequence;
4445
#[rustfmt::skip]
4546
#[allow(unused_imports)]
4647
mod prelude {
47-
#[cfg(all(not(feature = "std"), not(test)))]
48+
#[cfg(feature = "alloc")]
4849
pub use alloc::string::ToString;
49-
50-
#[cfg(any(feature = "std", test))]
51-
pub use std::string::ToString;
5250
}

0 commit comments

Comments
 (0)