Skip to content

Commit 6884d36

Browse files
committed
Merge #534: Add build error and README docs 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 #533. ACKs for top commit: Kixunil: ACK 2f84d32 apoelstra: ACK 2f84d32 Tree-SHA512: b25606739caa4f3a586f55cf774aa824a836f17fd19412087243d6d0b62f46900031c39d8f8bce1d5d42857b2dd0c9a5d6d6e7a559abd3aad250251f77dd9ef5
2 parents 1781af3 + 2f84d32 commit 6884d36

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ coins in a given Bitcoin transaction
3333
More information can be found in [the documentation](https://docs.rs/miniscript)
3434
or in [the `examples/` directory](https://github.com/apoelstra/rust-miniscript/tree/master/examples)
3535

36+
## Building
37+
38+
The cargo feature `std` is enabled by default. At least one of the features `std` or `no-std` or both must be enabled.
39+
40+
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.
3641

3742
## Minimum Supported Rust Version (MSRV)
3843
This library should always compile with any combination of features (minus

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ compile_error!(
9090
"rust-miniscript currently only supports architectures with pointers wider than 16 bits"
9191
);
9292

93+
#[cfg(not(any(feature = "std", feature = "no-std")))]
94+
compile_error!("at least one of the `std` or `no-std` features must be enabled");
95+
9396
pub use bitcoin;
9497

9598
#[cfg(not(feature = "std"))]

0 commit comments

Comments
 (0)