diff --git a/Cargo.toml b/Cargo.toml index 764ef1adb..645d9b034 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,19 +14,17 @@ rust-version = "1.63.0" [features] default = ["std"] std = ["bitcoin/std", "bitcoin/secp-recovery", "bech32/std"] -no-std = ["bech32/alloc"] compiler = [] trace = [] -serde = ["actual-serde", "bitcoin/serde"] +serde = ["dep:actual-serde", "bitcoin/serde"] rand = ["bitcoin/rand"] base64 = ["bitcoin/base64"] [dependencies] -bech32 = { version = "0.11.0", default-features = false } +bech32 = { version = "0.11.0", default-features = false, features = ["alloc"] } bitcoin = { version = "0.32.0", default-features = false } -# Do NOT use this as a feature! Use the `serde` feature instead. actual-serde = { package = "serde", version = "1.0.103", optional = true } [dev-dependencies] diff --git a/README.md b/README.md index 6e638ff2a..b58a9643e 100644 --- a/README.md +++ b/README.md @@ -27,24 +27,38 @@ are convertible to `bitcoin::PublicKey` completing an unsigned `bitcoin::TxIn` with appropriate data * Determining the specific keys, hash preimages and timelocks used to spend coins in a given Bitcoin transaction -* `no_std` support enabled by disabling the `default-features` and enabling -`"no-std"`. See `embedded/` for an example. +* `no_std` support enabled by disabling the `default-features`. See `embedded/` for an example. More information can be found in [the documentation](https://docs.rs/miniscript) or in [the `examples/` directory](https://github.com/rust-bitcoin/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. +The cargo feature `std` is enabled by default. To enable `no_std` support you must disable default features. -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. +The library can be built and tested using [`cargo`](https://github.com/rust-lang/cargo/): + +``` +git clone git@github.com:rust-bitcoin/rust-miniscript.git +cd rust-miniscript +cargo build +``` + +You can run tests with: + +``` +cargo test +``` + +Please refer to the [`cargo` documentation](https://doc.rust-lang.org/stable/cargo/) for more +detailed instructions. ## Minimum Supported Rust Version (MSRV) This library should always compile with any combination of features on **Rust 1.63.0**. Some dependencies do not play nicely with our MSRV, if you are running the tests -you may need to pin some dependencies. See `./contrib/test.sh` for current pinning. +you may need to pin some dependencies. See `./contrib/pin.sh` for current pinning. ## Contributing diff --git a/contrib/test_vars.sh b/contrib/test_vars.sh index 337c4e921..2390b8348 100644 --- a/contrib/test_vars.sh +++ b/contrib/test_vars.sh @@ -7,12 +7,8 @@ # Test all these features with "std" enabled. FEATURES_WITH_STD="compiler trace serde rand base64" -# Test all these features with "no-std" enabled. -# rust-miniscript only: https://github.com/rust-bitcoin/rust-miniscript/issues/681 -FEATURES_WITH_NO_STD="compiler trace serde rand base64" - # Test all these features without "std" enabled. -FEATURES_WITHOUT_STD="" +FEATURES_WITHOUT_STD="compiler trace serde rand base64" # Run these examples. # Note `examples/big` should not be run. diff --git a/embedded/Cargo.toml b/embedded/Cargo.toml index 744c51733..15ac8ac4f 100644 --- a/embedded/Cargo.toml +++ b/embedded/Cargo.toml @@ -15,7 +15,7 @@ cortex-m-rt = "0.6.10" cortex-m-semihosting = "0.3.3" panic-halt = "0.2.0" alloc-cortex-m = "0.4.1" -miniscript = { path = "../", default-features = false, features = ["no-std"] } +miniscript = { path = "../", default-features = false } [[bin]] name = "embedded" diff --git a/src/lib.rs b/src/lib.rs index 63885ab75..6ad5c9a08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,9 +89,6 @@ 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"))]