Skip to content

add basic IP support in HermitCore #69404

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

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1350,9 +1350,9 @@ dependencies = [

[[package]]
name = "hermit-abi"
version = "0.1.1"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f22b8f315b98f415780ddbe9163c7dbbc5a07225b6d102ace1d8aeef85775140"
checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
dependencies = [
"compiler_builtins",
"libc",
Expand Down
1 change: 0 additions & 1 deletion src/libpanic_unwind/hermit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use alloc::boxed::Box;
use core::any::Any;
use core::ptr;

pub unsafe fn cleanup(_ptr: *mut u8) -> Box<dyn Any + Send> {
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/os/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cfg_if::cfg_if! {
// If we're not documenting libstd then we just expose the main modules
// as we otherwise would.

#[cfg(any(target_os = "redox", unix, target_os = "vxworks"))]
#[cfg(any(target_os = "redox", unix, target_os = "vxworks", target_os = "hermit"))]
#[stable(feature = "rust1", since = "1.0.0")]
pub use crate::sys::ext as unix;

Expand Down
38 changes: 38 additions & 0 deletions src/libstd/sys/hermit/ext/ffi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//! HermitCore-specific extension to the primitives in the `std::ffi` module
//!
//! # Examples
//!
//! ```
//! use std::ffi::OsString;
//! use std::os::hermit::ffi::OsStringExt;
//!
//! let bytes = b"foo".to_vec();
//!
//! // OsStringExt::from_vec
//! let os_string = OsString::from_vec(bytes);
//! assert_eq!(os_string.to_str(), Some("foo"));
//!
//! // OsStringExt::into_vec
//! let bytes = os_string.into_vec();
//! assert_eq!(bytes, b"foo");
//! ```
//!
//! ```
//! use std::ffi::OsStr;
//! use std::os::hermit::ffi::OsStrExt;
//!
//! let bytes = b"foo";
//!
//! // OsStrExt::from_bytes
//! let os_str = OsStr::from_bytes(bytes);
//! assert_eq!(os_str.to_str(), Some("foo"));
//!
//! // OsStrExt::as_bytes
//! let bytes = os_str.as_bytes();
//! assert_eq!(bytes, b"foo");
//! ```

#![stable(feature = "rust1", since = "1.0.0")]

#[stable(feature = "rust1", since = "1.0.0")]
pub use crate::sys_common::os_str_bytes::*;
14 changes: 14 additions & 0 deletions src/libstd/sys/hermit/ext/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)]

pub mod ffi;

/// A prelude for conveniently writing platform-specific code.
///
/// Includes all extension traits, and some important type definitions.
#[stable(feature = "rust1", since = "1.0.0")]
pub mod prelude {
#[doc(no_inline)]
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::ffi::{OsStrExt, OsStringExt};
}
5 changes: 2 additions & 3 deletions src/libstd/sys/hermit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod args;
pub mod cmath;
pub mod condvar;
pub mod env;
pub mod ext;
pub mod fast_thread_local;
pub mod fd;
pub mod fs;
Expand Down Expand Up @@ -93,9 +94,7 @@ pub unsafe extern "C" fn __rust_abort() {

#[cfg(not(test))]
pub fn init() {
unsafe {
let _ = net::init();
}
let _ = net::init();
}

#[cfg(not(test))]
Expand Down
Loading