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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hermit-abi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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. :-)

#![feature(const_raw_ptr_to_usize_cast)]
#![no_std]
extern crate libc;

pub mod tcplistener;
Expand Down