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

Fix no_std support #229

Merged
merged 1 commit into from
Aug 17, 2021
Merged

Fix no_std support #229

merged 1 commit into from
Aug 17, 2021

Conversation

daxpedda
Copy link
Contributor

Apparently rust and cargo can't check for dependency support for no_std, one easy way to test it is to use the thumbv6m-none-eabi target, which I included now in CI.

This helped narrow down what dependencies were actually broken for no_std support.
generic-bytes had to be removed, because it doesn't have no_std support. This wasn't an issue per se, but some of it's functionality had to be replaced with custom functions, back-porting this to opaque-ke 1.0 would be a breaking change I have no clue exactly how to solve.

A common bug, see rust-lang/cargo#4866, unified std features from a dev-dependency on normal builds, this was easily rectified by switching to the new feature resolver version.
The new resolver has an MSRV of 1.51, which works fine for this version, but not if we want to backport it to opaque-ke 1.0, which will have to be fixed differently. This isn't an issue that will affect consumers of this library, it's only an issue for us during testing.

For WASM, I think there was some misconception around the getrandom crate and no_std support. If you wanna use no_std with WASM, you can't use wasm-bindgen, which I believe requires std support. So to support for no_std, a user will have to provide their own implementation to be passed into functions.

I also added testing to automatically activate the "std" crate feature.

Additionally any calls to typenum::Unsigned::to_usize() were replaced with typenum::Unsigned::USIZE.

@kevinlewi kevinlewi merged commit 6c78405 into facebook:master Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants