Skip to content

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Sep 24, 2025

This does everything in the issue description of #850. I'm not sure why I opened #856 also, and I'm confused by the first two check points of 856 as well.

Follow up #844.

Close #850

@tcharding
Copy link
Member Author

Needs #860 to get past CI.

@apoelstra
Copy link
Member

In 3f6c383:

You can't reexport the same symbol with different types based on a feature gate. This makes the features non-additive. Why export these?

@apoelstra
Copy link
Member

f4d8fb4 looks good otherwise.

@tcharding
Copy link
Member Author

This makes the features non-additive.

Oooph, of course.

@apoelstra
Copy link
Member

ping @tcharding

@tcharding
Copy link
Member Author

In 3f6c383:

You can't reexport the same symbol with different types based on a feature gate. This makes the features non-additive. Why export these?

AFAICT the type is set exactly by the feature std because of how we set the path to internal. So if std feature is on you get the std one irrespective of what other features are on. What am I missing?

#[cfg_attr(feature = "std", path = "internal_std.rs")]
#[cfg_attr(not(feature = "std"), path = "internal_nostd.rs")]
mod internal;

#[cfg(not(feature = "std"))]
mod spinlock;

pub use internal::{
    rerandomize_global_context, with_global_context, with_raw_global_context, SECP256K1,
};

Delete the old global context, make the new ones `pub`, and re-export
them in the `context` modulue (implies they are also re-exported at
crate root). Exactly which one is re-exported depends on whether the
crate is built with `std` or not.
Now that we fully use the new global contexts that work both with and
without `std` we can delete the `global-context` and
`global-context-less-secure` features.
One stale construction of a context in docs, remove it.
@tcharding
Copy link
Member Author

tcharding commented Oct 1, 2025

Rebased to see if lint warnings go away. No other changes.

At first we deprecated these but since we have a global context that
works with and without `std` and we deleted the `global-context`
feature we might as well just clobber these 2 functions now also.
@apoelstra
Copy link
Member

So if std feature is on you get the std one irrespective of what other features are on. What am I missing?

If std is on you get a different type than if std is off. This means that std is not additive.

@tcharding
Copy link
Member Author

oooo, I get it. You build with no-std, get one type, then someone else in your stack enables std and you get borked.

@tcharding tcharding marked this pull request as draft October 2, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finish off removing context
3 participants