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 <joerichey@google.com>
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 <joerichey@google.com>
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 <joerichey@google.com>
| //! `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.
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.
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.
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.
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.
A sorry, I got confused there for a moment. Thanks for the clarification.
There was a problem hiding this comment.
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.
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.
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.
I will fix with another PR.
There was a problem hiding this comment.
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-abiable to build byjust using
-Zbuild-std=coreinstead of needing all of-Zbuild-std.Also, remove an unnecessary feature that isn't used anywhere.
Signed-off-by: Joe Richey joerichey@google.com