Skip to content

Commit

Permalink
Merge rust-bitcoin/rust-miniscript#534: Add build error and README do…
Browse files Browse the repository at this point in the history
…cs for proper use of std and no-std features

2f84d32 Add README build docs for std and no-std (Steve Myers)
d1c71e3 Add build error if both std and no-std features disabled (Steve Myers)

Pull request description:

  Building this crate requires the std and/or no-std features be enabled. This PR documents this build constraint in the README and gives an error is anyone tries to build without enabling one or both of these features.

  See discussion in rust-bitcoin#533.

ACKs for top commit:
  Kixunil:
    ACK 2f84d32
  apoelstra:
    ACK 2f84d32

Tree-SHA512: b25606739caa4f3a586f55cf774aa824a836f17fd19412087243d6d0b62f46900031c39d8f8bce1d5d42857b2dd0c9a5d6d6e7a559abd3aad250251f77dd9ef5
  • Loading branch information
apoelstra committed Mar 18, 2023
2 parents 1781af3 + 2f84d32 commit 6884d36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ coins in a given Bitcoin transaction
More information can be found in [the documentation](https://docs.rs/miniscript)
or in [the `examples/` directory](https://github.com/apoelstra/rust-miniscript/tree/master/examples)

## Building

The cargo feature `std` is enabled by default. At least one of the features `std` or `no-std` or both must be enabled.

Enabling the `no-std` feature does not disable `std`. To disable the `std` feature you must disable default features. The `no-std` feature only enables additional features required for this crate to be usable without `std`. Both can be enabled without conflict.

## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features (minus
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ compile_error!(
"rust-miniscript currently only supports architectures with pointers wider than 16 bits"
);

#[cfg(not(any(feature = "std", feature = "no-std")))]
compile_error!("at least one of the `std` or `no-std` features must be enabled");

pub use bitcoin;

#[cfg(not(feature = "std"))]
Expand Down

0 comments on commit 6884d36

Please sign in to comment.