Skip to content

Commit 14d54ad

Browse files
committed
Enable build with global-context-less-secure
Currently this command fails: cargo build --no-default-features --features=global-context-less-secure 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`. With this applied the build command above runs successfully.
1 parent 73f1aa6 commit 14d54ad

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rand-std = ["rand/std"]
2727
recovery = ["secp256k1-sys/recovery"]
2828
lowmemory = ["secp256k1-sys/lowmemory"]
2929
global-context = ["std", "rand-std", "global-context-less-secure"]
30-
global-context-less-secure = []
30+
global-context-less-secure = ["std"]
3131

3232
[dependencies]
3333
secp256k1-sys = { version = "0.4.2", default-features = false, path = "./secp256k1-sys" }

contrib/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh -ex
22

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

55
# Use toolchain if explicitly specified
66
if [ -n "$TOOLCHAIN" ]

src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub mod global {
3535
impl Deref for GlobalContext {
3636
type Target = Secp256k1<All>;
3737

38+
#[allow(unused_mut)] // Unused when "global-context" is not enabled.
3839
fn deref(&self) -> &Self::Target {
3940
static ONCE: Once = Once::new();
4041
static mut CONTEXT: Option<Secp256k1<All>> = None;

0 commit comments

Comments
 (0)