Skip to content

Hermit: Unify std::env::args with Unix #139711

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
35 changes: 0 additions & 35 deletions library/std/src/sys/args/hermit.rs

This file was deleted.

8 changes: 4 additions & 4 deletions library/std/src/sys/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#![forbid(unsafe_op_in_unsafe_fn)]

cfg_if::cfg_if! {
if #[cfg(all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))))] {
if #[cfg(any(
all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))),
target_os = "hermit",
))] {
mod unix;
pub use unix::*;
} else if #[cfg(target_family = "windows")] {
mod windows;
pub use windows::*;
} else if #[cfg(target_os = "hermit")] {
mod hermit;
pub use hermit::*;
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
mod sgx;
pub use sgx::*;
Expand Down
6 changes: 5 additions & 1 deletion library/std/src/sys/args/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#![allow(dead_code)] // runtime init functions not used during testing

use crate::ffi::CStr;
#[cfg(target_os = "hermit")]
use crate::os::hermit::ffi::OsStringExt;
#[cfg(not(target_os = "hermit"))]
use crate::os::unix::ffi::OsStringExt;

#[path = "common.rs"]
Expand Down Expand Up @@ -73,6 +76,7 @@ pub fn args() -> Args {
target_os = "illumos",
target_os = "emscripten",
target_os = "haiku",
target_os = "hermit",
target_os = "l4re",
target_os = "fuchsia",
target_os = "redox",
Expand Down Expand Up @@ -100,7 +104,7 @@ mod imp {

unsafe fn really_init(argc: isize, argv: *const *const u8) {
// These don't need to be ordered with each other or other stores,
// because they only hold the unmodified system-provide argv/argc.
// because they only hold the unmodified system-provided argv/argc.
ARGC.store(argc, Ordering::Relaxed);
ARGV.store(argv as *mut _, Ordering::Relaxed);
}
Expand Down
Loading