wasmparser: minimize diff for no_std support mirrors #454
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 does not introduce
no_std
support to thewasmparser
crate.Instead it just simplifies the process of supporting a
no_std
mirror of thewasmparser
crate by minimizing the required diff.This also replaces
Hash{Map,Set}
usage in thewasmparser
validator withBTree{Map,Set}
since those are not attackable inno_std
environments. I saw absolutely no difference in the benchmarks. UsingBTree{Map,Set}
also leads to more deterministic runtime behavior in general.@alexcrichton Many projects would love to use this high quality and battle tested Wasm parsing and validation crate in a
no_std
environment so I thought about a solution that fits those projects while not putting a burden on the maintainers (you). This PR just minimizes the diff needed to add trivialno_std
support towasmparser
but does not actually introduceno_std
support. With this PR it will become very easy to maintain ano_std
fork ofwasmparser
and keep it in sync. I'd be happy to know how you feel about this idea.Link to
no_std
wasmparser
fork: https://crates.io/crates/wasmparser-nostd