-
Notifications
You must be signed in to change notification settings - Fork 86
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
vstd: Add no-std build mode #772
Conversation
6af219d
to
8a24f2e
Compare
Rebased after #733. Since Tested that a default build using vargo produces a std-enabled vstd build, and with |
Hi @zhaofengli, and thank you for the PR! I'll try and get to it quickly (likely, in a day or two). |
Otherwise fails when alloc is disabled.
This is more idiomatic compared to negative features (non_std, non_global_allocator). By default, those features are enabled in Cargo.toml and will be opted-into by vstd_build. * fixup no-std after 803
8a24f2e
to
bcaf627
Compare
Thank you for rebasing, and sorry for the delay! |
One question: is it correct that with this PR there isn't a way when building to set |
bcaf627
to
631ff6a
Compare
I just moved disabling alloc to a separate flag in vargo. Now both |
Thank you! Looks good. Just one last check on the |
There seem to be a couple more fixes needed:
I made these fixes and opened a PR against this branch: mars-research#1 |
This reverts commit a43d536.
* ensures vstd is rebuilt when the `--vstd-no*` flags change * use the `alloc` crate when necessary for `--vstd-no-std` without `--vstd-no-alloc`
Thanks for the fixes! I've merged the commits. |
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.
Looks good to me. I'd like for @tjhance to have a look too, in particular at the changes that involve using the alloc
crate.
source/pervasive/std_specs/vec.rs
Outdated
@@ -222,6 +222,7 @@ pub fn ex_vec_as_slice<T, A: Allocator>(vec: &Vec<T, A>) -> (slice: &[T]) | |||
vec.as_slice() | |||
} | |||
|
|||
#[cfg(feature = "std")] |
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.
why's this needed? is split_off not available with just alloc
?
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.
Good catch! I went over vstd and did the following:
- Removed the gate in question, changed
std::clone::Clone
tocore::clone::Clone
- Removed redundant
extern crate alloc
- Made the gate on
string
more fine-grained (string slices can be used withoutalloc
)
(Sorry for the late reply, was away yesterday)
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.
looks fine to me
Merged as d2fd642 |
This PR adds a
#![no_std]
build mode for vstd. It can be activated by passing--vstd-no-std
and optionally--vstd-no-alloc
to vargo.