-
Notifications
You must be signed in to change notification settings - Fork 90
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
Allow hermit-abi to build without std #103
Conversation
This makes crates depending on hermit-abi able to check their build by just using `-Zbuild-std=core` instead of needing all of `-Zbuild-std`. Also, remove an unnecessary feature that isn't used anywhere. Signed-off-by: Joe Richey <[email protected]>
We can just use secure_rand64, which should allow us to avoid aarch64 issues. Note we have to build all of libstd to test this, see hermit-os/hermit-rs#103 for more information. Signed-off-by: Joe Richey <[email protected]>
We can just use secure_rand64, which should allow us to avoid aarch64 issues. Note we have to build all of libstd to test this, see hermit-os/hermit-rs#103 for more information. Signed-off-by: Joe Richey <[email protected]>
@@ -1,8 +1,7 @@ | |||
//! `hermit-abi` is small interface to call functions from the unikernel | |||
//! [RustyHermit](https://github.com/hermitcore/libhermit-rs). | |||
|
|||
#![cfg_attr(feature = "rustc-dep-of-std", no_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.
I'm fairly sure that this line is needed, since the hermit std
library (in the rust compiler) depends on the hermit-abi crate.
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.
This just removes the cfg_attr
so that this crate is always no_std
, so things should still work correctly with it being a dep of libstd.
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.
AFAIK as of now, it is still necessary to have rustc-dep-of-std
in dependencies of std
library crates.
There is a plan to remove it (rust-lang/wg-cargo-std-aware#51), but the issue is still open.
This issue is to discuss the strategy for removing the rustc-dep-of-std feature and the rust-std-workspace-* packages which allows standard library crates to use crates from crates.io
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.
That is correct, and that feature isn't removed by this PR.
EDIT: All this PR does is remove the gating of no_std
based on the rustc-dep-of-std
feature. Right now, this crate requires std
unless the rustc-dep-of-std
feature is enabled, in which case std
is not required.
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.
A sorry, I got confused there for a moment. Thanks for the clarification.
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.
For example, libc
(which is also a dependency of std
) is just unconditionally no_std
, see: https://github.com/rust-lang/libc/blob/715b50e1555a339d4e474ac4f6ae5a944bc1b180/src/lib.rs#L28
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.
The current network support depends on std
. libstd
doesn't select this feature. But we should make sure that this is not enabled if std
is not enabled.
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.
It looks like that support is in a different crate, this crate (hermit-abi
) is just a facade crate that doesn't depend on any std code or types.
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.
I will fix with another PR.
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.
It looks like that support is in a different crate, this crate (
hermit-abi
) is just a facade crate that doesn't depend on any std code or types.
Sorry, my mistake. I mixed up hermit-sys
and hermit-abi
. :-)
bors r+ |
This makes crates depending on
hermit-abi
able to build byjust using
-Zbuild-std=core
instead of needing all of-Zbuild-std
.Also, remove an unnecessary feature that isn't used anywhere.
Signed-off-by: Joe Richey [email protected]