Merge rust-bitcoin/rust-bitcoin#3140: primitives: Fix alloc feature

3b5bcd0983 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 3b5bcd0983
  apoelstra:
    ACK 3b5bcd0983 successfully ran local tests

Tree-SHA512: f042dfb368dc0bde16237764a0dd09def7eeeb59291a5dbb1b5bd5f1dcd49b3adf66c12508c3be4f0ff48b52cd31cbb20edea68d9d55760e99c506ac5b114781
This commit is contained in:
merge-script 2024-08-08 21:18:09 +00:00
commit 8ac0e60d84
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 2 additions and 4 deletions

View File

@ -18,6 +18,7 @@
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
#![allow(clippy::needless_borrows_for_generic_args)] // https://github.com/rust-lang/rust-clippy/issues/12454
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
@ -44,9 +45,6 @@ pub use self::sequence::Sequence;
#[rustfmt::skip]
#[allow(unused_imports)]
mod prelude {
#[cfg(all(not(feature = "std"), not(test)))]
#[cfg(feature = "alloc")]
pub use alloc::string::ToString;
#[cfg(any(feature = "std", test))]
pub use std::string::ToString;
}