Chore(no_std): fix various compilation errors for no std crates #9564
+63
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR closes #9478 Fix various compilation errors for no-std in crates.
After reading around, it seems that if a crate is going to support
no_std
, it should makestd
opt in. This is the official recommendation because it saves the work of having to make things supportno_std
after having developed everything with stablestd
features.I went through all the crates running the command below:
and the following crates had compilation errors:
Crates with compilation errors
cargo c --no-default-features -p reth-network-api
, I'm getting the following error:use of undeclared crate or module serde
serde
supportno_std
, thestd
feature has to be configured todefault-features = false
.serde-json-core
must be used instead ofserde-json
.serde
docs:Be aware that Cargo features are unioned together across your entire dependency graph. That means if any other crate you depend on has not opted out of Serde's default features, you will build Serde with the std feature enabled whether or not your direct dependency on Serde has default-features = false
.reth-network-api
I may have to go through all the crates thatreth-network-api
depends on. I hope it doesn't include external cratesreth
depends on, as just making these changes seems like it could affect a large part of the codebase.jsonrpsee
ErrorObject