Skip to content

Commit

Permalink
Enable build with global-context-less-secure
Browse files Browse the repository at this point in the history
All features should be able to be built individually, this is currently
not the case with `global-context-less-secure`.

Enable `std` if `global-context-less-secure` is enabled (because `Once`
only comes from `std`, not available in `core`).

Add `global-context-less-secure` to the features test array in
`contrib/test.sh`.
  • Loading branch information
tcharding committed Jan 25, 2022
1 parent 33a6fb5 commit 86baad5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rand-std = ["rand/std"]
recovery = ["secp256k1-sys/recovery"]
lowmemory = ["secp256k1-sys/lowmemory"]
global-context = ["std", "rand-std", "global-context-less-secure"]
global-context-less-secure = []
global-context-less-secure = ["std"]

[dependencies]
secp256k1-sys = { version = "0.4.2", default-features = false, path = "./secp256k1-sys" }
Expand Down
2 changes: 1 addition & 1 deletion contrib/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh -ex

FEATURES="bitcoin_hashes global-context lowmemory rand rand-std recovery serde"
FEATURES="bitcoin_hashes global-context-less-secure global-context lowmemory rand rand-std recovery serde"

# Use toolchain if explicitly specified
if [ -n "$TOOLCHAIN" ]
Expand Down
4 changes: 2 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ use Secp256k1;
pub use self::alloc_only::*;

#[cfg(feature = "global-context-less-secure")]
#[cfg_attr(docsrs, doc(cfg(any(feature = "global-context", feature = "global-context-less-secure"))))]
#[cfg_attr(docsrs, doc(cfg(feature = "global-context-less-secure")))]
/// Module implementing a singleton pattern for a global `Secp256k1` context
pub mod global {
#[cfg(feature = "global-context")]
use rand;

use std::ops::Deref;
use core::ops::Deref;
use std::sync::Once;
use {Secp256k1, All};

Expand Down

0 comments on commit 86baad5

Please sign in to comment.