Skip to content
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

Merged
merged 1 commit into from
Jan 14, 2021
Merged

Conversation

josephlr
Copy link
Contributor

This makes crates depending on hermit-abi able to 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]

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]>
josephlr added a commit to rust-random/getrandom that referenced this pull request Jan 14, 2021
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]>
josephlr added a commit to rust-random/getrandom that referenced this pull request Jan 14, 2021
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)]
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@jschwe jschwe Jan 14, 2021

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

Copy link
Contributor Author

@josephlr josephlr Jan 14, 2021

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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. :-)

@stlankes
Copy link
Contributor

bors r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants