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 creates a new cargo feature
std
, on by default, that can be disabled if the user wants to target an environment with no support forstd
library.Motivation
Crate is now supported in a larger number of targets, and is a step into fixing this issue: bluealloy/revm#493.
Solution
This crate doesn't really use any std feature (e.g., threads, IO, file, network). It is a pure computation library, and theoretically it could be pure
#![no_std]
with no need for a feature to enable "std". But unfortunately I hit into two issues:thiserror
is currently std-only (no_std support on nightly dtolnay/thiserror#211), and the solution to makethiserror
no_std depends on a unstable rust feature (Tracking Issue forError
incore
rust-lang/rust#103765).std
(likelog2
,abs
,pow
, etc), this is an issue of LLVM relying on the system libraries implementation for these functions. This also happens withmemcpy
and integer division functions, which LLVM assumes to exist, and is solved by including these functions incompiler_builtins
library that can be used by no_std projects. For some reason, the corresponding floating point functions are not incompiler_builtins
yet (Tracking issue for f32 and f64 methods in libcore rust-lang/rust#50145). Thus, whenstd
is disabled, this PR disables moduleslog
,pow
androot
, along withFrom<f64>
andFrom<f32>
implementations, all which relies on the missing floating point functions.PR Checklist