Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove no-std and actual-serde features #769

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ 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: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 }
serde = { version = "1.0.103", optional = true }

[dev-dependencies]
serde_test = "1.0.147"
Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,17 @@ 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.

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 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.

Comment on lines -47 to 41
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is good, its an unrelated change for this PR though. (Sorry for being picky, we just uncovered a bug in rust-bitcoin that slipped through review so I'm trying to review more anally diligently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, no worries about being thorough. It is unrelated, but I figured it was okay since it’s just an outdated path in the README.

## Contributing

Expand Down
6 changes: 1 addition & 5 deletions contrib/test_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mad! If this merges we can patch rust-bitcoin-maintainer-tools to remove the logic that supports this.

FEATURES_WITHOUT_STD=""
FEATURES_WITHOUT_STD="compiler trace serde rand base64"

# Run these examples.
# Note `examples/big` should not be run.
Expand Down
2 changes: 1 addition & 1 deletion embedded/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand All @@ -102,7 +99,7 @@ extern crate alloc;
extern crate core;

#[cfg(feature = "serde")]
pub use actual_serde as serde;
pub use serde;

#[cfg(bench)]
extern crate test;
Expand Down
Loading