-
Notifications
You must be signed in to change notification settings - Fork 21
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
Introduce support for environments where the standard library is not available (#![no_std]) but a global allocator is #59
base: master
Are you sure you want to change the base?
Conversation
…td features are not enabled
…nality (no_std support) without breaking existing API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Supporting no_std
would be useful. Before reviewing details in this branch, let me request some points:
- Would you apply the following patch and revert the code commented out due to warnings?
diff --git a/spec-test/src/main.rs b/spec-test/src/main.rs index ddbd226..d502206 100644 --- a/spec-test/src/main.rs +++ b/spec-test/src/main.rs @@ -1,4 +1,5 @@ #![forbid(unsafe_code)] +#![allow(dead_code)] mod crash; mod error;
- Would you revert the package version bumps in this PR? I will do them in my side after understanding the changes. Since the major versions are zero, patch versions should be bumped if there are no breaking changes.
- Could you run the spec test on this branch with enabling
no_std
and compare the results withmain
branch? If the numbers of passed test cases don't match, it would mean that there are some mistakes in the implementation added in this branch.- On my local machine, the results of the speci tests are:
total: 19757, passed: 19460, failed: 179, skipped: 118
- On my local machine, the results of the speci tests are:
Thank you for your reply! I've reverted the version changes and commenting-out of "dead" code, as well as added With regards to the failing tests numbers, I've added a
Is there anything else you would like? Thanks again! |
Wow, passing the same spec-tests is great. I'll review the details. Since this PR is a bit larger, let me take a look at it on the weekend. |
pub struct DefaultImporter<R: Read, W: Write> { | ||
/// With `no_std` feature enabled, there is no `DefaultImporter`, it is up to you to create one suitable for your system. | ||
#[cfg(not(feature = "no_std"))] | ||
pub struct DefaultImporter<R, W> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Why DefaultImporter
cannot be implemented when no_std
?
use alloc::fmt; | ||
use alloc::{borrow::Cow, vec::Vec}; | ||
#[cfg(feature = "hashbrown")] | ||
use hashbrown::HashMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alloc::collections::BTreeMap
is available. Can we use BTreeMap
instead of introducing a new dependency hashbrown
on no_std
? Or should we still use hashbrown?
This PR introduces support for environments where the standard library is not available but a global allocator is (i.e. embedded usecase) to the "subcrates" in this repository -
wain-ast
,wain-syntax-text
,wain-syntax-binary
,wain-validate
andwain-exec
.wain-ast
:0.3.0
.wain-exec
:no_std
non-default feature.libm
- this is only included with theno_std
feature to make the claim that "no other dependencies are used" true for the default featureset.0.4.0
.execute
function andDefaultImporter
are not available when theno_std
feature is enabled - developers who wish to use this feature need to create their ownImporter
and use runtime APIs to create and run aRuntime
that uses it.wain-syntax-binary
:0.2.0
.wain-syntax-text
:no_std
non-default feature.libm
andhashbrown
- this is only included with theno_std
feature to make the claim that "no other dependencies are used" true for the default featureset.0.3.0
.wain-validate
:no_std
non-default feature.hashbrown
- this is only included with theno_std
feature to make the claim that "no other dependencies are used" true for the default featureset.0.2.0
.Additionally, post-commit hooks were failing due to Clippy identified "dead code" in
spec-test
. I did not alter the code inspec-test
to introduce#![no_std]
support however have commented out the code that turned out to be actually dead and added Clippy ignore directives to the code that was being used in the tests but not detected by Clippy, in order to get these checks to pass and resolve all Clippy warnings.If you decide to approve this PR, can you please deploy the new versions of the crates to
crates.io
so that I can use them more easily in my project?Thank you for your time!