about summary refs log tree commit diff
path: root/library/std/src/sys/pal
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/sys/pal')
-rw-r--r--library/std/src/sys/pal/hermit/args.rs66
-rw-r--r--library/std/src/sys/pal/hermit/mod.rs3
-rw-r--r--library/std/src/sys/pal/sgx/args.rs59
-rw-r--r--library/std/src/sys/pal/sgx/mod.rs3
-rw-r--r--library/std/src/sys/pal/solid/mod.rs2
-rw-r--r--library/std/src/sys/pal/teeos/mod.rs2
-rw-r--r--library/std/src/sys/pal/trusty/mod.rs2
-rw-r--r--library/std/src/sys/pal/uefi/args.rs156
-rw-r--r--library/std/src/sys/pal/uefi/mod.rs1
-rw-r--r--library/std/src/sys/pal/unix/args.rs243
-rw-r--r--library/std/src/sys/pal/unix/mod.rs6
-rw-r--r--library/std/src/sys/pal/unix/thread.rs20
-rw-r--r--library/std/src/sys/pal/unix/time.rs11
-rw-r--r--library/std/src/sys/pal/unix/weak.rs3
-rw-r--r--library/std/src/sys/pal/unsupported/args.rs36
-rw-r--r--library/std/src/sys/pal/unsupported/mod.rs1
-rw-r--r--library/std/src/sys/pal/wasi/args.rs61
-rw-r--r--library/std/src/sys/pal/wasi/mod.rs1
-rw-r--r--library/std/src/sys/pal/wasip2/mod.rs2
-rw-r--r--library/std/src/sys/pal/wasm/mod.rs2
-rw-r--r--library/std/src/sys/pal/windows/args.rs445
-rw-r--r--library/std/src/sys/pal/windows/args/tests.rs91
-rw-r--r--library/std/src/sys/pal/windows/c.rs4
-rw-r--r--library/std/src/sys/pal/windows/c/bindings.txt4
-rw-r--r--library/std/src/sys/pal/windows/c/windows_sys.rs303
-rw-r--r--library/std/src/sys/pal/windows/mod.rs1
-rw-r--r--library/std/src/sys/pal/xous/args.rs53
-rw-r--r--library/std/src/sys/pal/xous/mod.rs1
-rw-r--r--library/std/src/sys/pal/zkvm/args.rs81
-rw-r--r--library/std/src/sys/pal/zkvm/mod.rs4
30 files changed, 302 insertions, 1365 deletions
diff --git a/library/std/src/sys/pal/hermit/args.rs b/library/std/src/sys/pal/hermit/args.rs
deleted file mode 100644
index 44024260277..00000000000
--- a/library/std/src/sys/pal/hermit/args.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-use crate::ffi::{CStr, OsString, c_char};
-use crate::os::hermit::ffi::OsStringExt;
-use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
-use crate::sync::atomic::{AtomicIsize, AtomicPtr};
-use crate::{fmt, ptr, vec};
-
-static ARGC: AtomicIsize = AtomicIsize::new(0);
-static ARGV: AtomicPtr<*const u8> = AtomicPtr::new(ptr::null_mut());
-
-/// One-time global initialization.
-pub unsafe fn init(argc: isize, argv: *const *const u8) {
-    ARGC.store(argc, Relaxed);
-    // Use release ordering here to broadcast writes by the OS.
-    ARGV.store(argv as *mut *const u8, Release);
-}
-
-/// Returns the command line arguments
-pub fn args() -> Args {
-    // Synchronize with the store above.
-    let argv = ARGV.load(Acquire);
-    // If argv has not been initialized yet, do not return any arguments.
-    let argc = if argv.is_null() { 0 } else { ARGC.load(Relaxed) };
-    let args: Vec<OsString> = (0..argc)
-        .map(|i| unsafe {
-            let cstr = CStr::from_ptr(*argv.offset(i) as *const c_char);
-            OsStringExt::from_vec(cstr.to_bytes().to_vec())
-        })
-        .collect();
-
-    Args { iter: args.into_iter() }
-}
-
-pub struct Args {
-    iter: vec::IntoIter<OsString>,
-}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.iter.as_slice().fmt(f)
-    }
-}
-
-impl !Send for Args {}
-impl !Sync for Args {}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        self.iter.next()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.iter.size_hint()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.iter.len()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.iter.next_back()
-    }
-}
diff --git a/library/std/src/sys/pal/hermit/mod.rs b/library/std/src/sys/pal/hermit/mod.rs
index 26211bcb152..821836824e2 100644
--- a/library/std/src/sys/pal/hermit/mod.rs
+++ b/library/std/src/sys/pal/hermit/mod.rs
@@ -18,7 +18,6 @@
 
 use crate::os::raw::c_char;
 
-pub mod args;
 pub mod env;
 pub mod futex;
 pub mod os;
@@ -58,7 +57,7 @@ pub extern "C" fn __rust_abort() {
 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
 pub unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
     unsafe {
-        args::init(argc, argv);
+        crate::sys::args::init(argc, argv);
     }
 }
 
diff --git a/library/std/src/sys/pal/sgx/args.rs b/library/std/src/sys/pal/sgx/args.rs
deleted file mode 100644
index e62bf383954..00000000000
--- a/library/std/src/sys/pal/sgx/args.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-use super::abi::usercalls::alloc;
-use super::abi::usercalls::raw::ByteBuffer;
-use crate::ffi::OsString;
-use crate::sync::atomic::{AtomicUsize, Ordering};
-use crate::sys::os_str::Buf;
-use crate::sys_common::FromInner;
-use crate::{fmt, slice};
-
-#[cfg_attr(test, linkage = "available_externally")]
-#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE")]
-static ARGS: AtomicUsize = AtomicUsize::new(0);
-type ArgsStore = Vec<OsString>;
-
-#[cfg_attr(test, allow(dead_code))]
-pub unsafe fn init(argc: isize, argv: *const *const u8) {
-    if argc != 0 {
-        let args = unsafe { alloc::User::<[ByteBuffer]>::from_raw_parts(argv as _, argc as _) };
-        let args = args
-            .iter()
-            .map(|a| OsString::from_inner(Buf { inner: a.copy_user_buffer() }))
-            .collect::<ArgsStore>();
-        ARGS.store(Box::into_raw(Box::new(args)) as _, Ordering::Relaxed);
-    }
-}
-
-pub fn args() -> Args {
-    let args = unsafe { (ARGS.load(Ordering::Relaxed) as *const ArgsStore).as_ref() };
-    if let Some(args) = args { Args(args.iter()) } else { Args([].iter()) }
-}
-
-pub struct Args(slice::Iter<'static, OsString>);
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.0.as_slice().fmt(f)
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        self.0.next().cloned()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.0.size_hint()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.0.len()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.0.next_back().cloned()
-    }
-}
diff --git a/library/std/src/sys/pal/sgx/mod.rs b/library/std/src/sys/pal/sgx/mod.rs
index 52684e18ac2..8a87e7a7ae1 100644
--- a/library/std/src/sys/pal/sgx/mod.rs
+++ b/library/std/src/sys/pal/sgx/mod.rs
@@ -9,7 +9,6 @@ use crate::io::ErrorKind;
 use crate::sync::atomic::{AtomicBool, Ordering};
 
 pub mod abi;
-pub mod args;
 pub mod env;
 mod libunwind_integration;
 pub mod os;
@@ -24,7 +23,7 @@ pub mod waitqueue;
 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
 pub unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
     unsafe {
-        args::init(argc, argv);
+        crate::sys::args::init(argc, argv);
     }
 }
 
diff --git a/library/std/src/sys/pal/solid/mod.rs b/library/std/src/sys/pal/solid/mod.rs
index 22052a168fd..c41dc848a1b 100644
--- a/library/std/src/sys/pal/solid/mod.rs
+++ b/library/std/src/sys/pal/solid/mod.rs
@@ -16,8 +16,6 @@ pub mod itron {
     use super::unsupported;
 }
 
-#[path = "../unsupported/args.rs"]
-pub mod args;
 pub mod env;
 // `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
 // `crate::sys::error`
diff --git a/library/std/src/sys/pal/teeos/mod.rs b/library/std/src/sys/pal/teeos/mod.rs
index c1921a2f40d..b8095cec3e9 100644
--- a/library/std/src/sys/pal/teeos/mod.rs
+++ b/library/std/src/sys/pal/teeos/mod.rs
@@ -6,8 +6,6 @@
 #![allow(unused_variables)]
 #![allow(dead_code)]
 
-#[path = "../unsupported/args.rs"]
-pub mod args;
 #[path = "../unsupported/env.rs"]
 pub mod env;
 //pub mod fd;
diff --git a/library/std/src/sys/pal/trusty/mod.rs b/library/std/src/sys/pal/trusty/mod.rs
index 5295d3fdc91..04e6b4c8186 100644
--- a/library/std/src/sys/pal/trusty/mod.rs
+++ b/library/std/src/sys/pal/trusty/mod.rs
@@ -1,7 +1,5 @@
 //! System bindings for the Trusty OS.
 
-#[path = "../unsupported/args.rs"]
-pub mod args;
 #[path = "../unsupported/common.rs"]
 #[deny(unsafe_op_in_unsafe_fn)]
 mod common;
diff --git a/library/std/src/sys/pal/uefi/args.rs b/library/std/src/sys/pal/uefi/args.rs
deleted file mode 100644
index 0c29caf2db6..00000000000
--- a/library/std/src/sys/pal/uefi/args.rs
+++ /dev/null
@@ -1,156 +0,0 @@
-use r_efi::protocols::loaded_image;
-
-use super::helpers;
-use crate::env::current_exe;
-use crate::ffi::OsString;
-use crate::iter::Iterator;
-use crate::{fmt, vec};
-
-pub struct Args {
-    parsed_args_list: vec::IntoIter<OsString>,
-}
-
-pub fn args() -> Args {
-    let lazy_current_exe = || Vec::from([current_exe().map(Into::into).unwrap_or_default()]);
-
-    // Each loaded image has an image handle that supports `EFI_LOADED_IMAGE_PROTOCOL`. Thus, this
-    // will never fail.
-    let protocol =
-        helpers::image_handle_protocol::<loaded_image::Protocol>(loaded_image::PROTOCOL_GUID)
-            .unwrap();
-
-    let lp_size = unsafe { (*protocol.as_ptr()).load_options_size } as usize;
-    // Break if we are sure that it cannot be UTF-16
-    if lp_size < size_of::<u16>() || lp_size % size_of::<u16>() != 0 {
-        return Args { parsed_args_list: lazy_current_exe().into_iter() };
-    }
-    let lp_size = lp_size / size_of::<u16>();
-
-    let lp_cmd_line = unsafe { (*protocol.as_ptr()).load_options as *const u16 };
-    if !lp_cmd_line.is_aligned() {
-        return Args { parsed_args_list: lazy_current_exe().into_iter() };
-    }
-    let lp_cmd_line = unsafe { crate::slice::from_raw_parts(lp_cmd_line, lp_size) };
-
-    Args {
-        parsed_args_list: parse_lp_cmd_line(lp_cmd_line)
-            .unwrap_or_else(lazy_current_exe)
-            .into_iter(),
-    }
-}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.parsed_args_list.as_slice().fmt(f)
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-
-    fn next(&mut self) -> Option<OsString> {
-        self.parsed_args_list.next()
-    }
-
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.parsed_args_list.size_hint()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.parsed_args_list.len()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.parsed_args_list.next_back()
-    }
-}
-
-/// Implements the UEFI command-line argument parsing algorithm.
-///
-/// This implementation is based on what is defined in Section 3.4 of
-/// [UEFI Shell Specification](https://uefi.org/sites/default/files/resources/UEFI_Shell_Spec_2_0.pdf)
-///
-/// Returns None in the following cases:
-/// - Invalid UTF-16 (unpaired surrogate)
-/// - Empty/improper arguments
-fn parse_lp_cmd_line(code_units: &[u16]) -> Option<Vec<OsString>> {
-    const QUOTE: char = '"';
-    const SPACE: char = ' ';
-    const CARET: char = '^';
-    const NULL: char = '\0';
-
-    let mut ret_val = Vec::new();
-    let mut code_units_iter = char::decode_utf16(code_units.iter().cloned()).peekable();
-
-    // The executable name at the beginning is special.
-    let mut in_quotes = false;
-    let mut cur = String::new();
-    while let Some(w) = code_units_iter.next() {
-        let w = w.ok()?;
-        match w {
-            // break on NULL
-            NULL => break,
-            // A quote mark always toggles `in_quotes` no matter what because
-            // there are no escape characters when parsing the executable name.
-            QUOTE => in_quotes = !in_quotes,
-            // If not `in_quotes` then whitespace ends argv[0].
-            SPACE if !in_quotes => break,
-            // In all other cases the code unit is taken literally.
-            _ => cur.push(w),
-        }
-    }
-
-    // If exe name is missing, the cli args are invalid
-    if cur.is_empty() {
-        return None;
-    }
-
-    ret_val.push(OsString::from(cur));
-    // Skip whitespace.
-    while code_units_iter.next_if_eq(&Ok(SPACE)).is_some() {}
-
-    // Parse the arguments according to these rules:
-    // * All code units are taken literally except space, quote and caret.
-    // * When not `in_quotes`, space separate arguments. Consecutive spaces are
-    // treated as a single separator.
-    // * A space `in_quotes` is taken literally.
-    // * A quote toggles `in_quotes` mode unless it's escaped. An escaped quote is taken literally.
-    // * A quote can be escaped if preceded by caret.
-    // * A caret can be escaped if preceded by caret.
-    let mut cur = String::new();
-    let mut in_quotes = false;
-    while let Some(w) = code_units_iter.next() {
-        let w = w.ok()?;
-        match w {
-            // break on NULL
-            NULL => break,
-            // If not `in_quotes`, a space or tab ends the argument.
-            SPACE if !in_quotes => {
-                ret_val.push(OsString::from(&cur[..]));
-                cur.truncate(0);
-
-                // Skip whitespace.
-                while code_units_iter.next_if_eq(&Ok(SPACE)).is_some() {}
-            }
-            // Caret can escape quotes or carets
-            CARET if in_quotes => {
-                if let Some(x) = code_units_iter.next() {
-                    cur.push(x.ok()?);
-                }
-            }
-            // If quote then flip `in_quotes`
-            QUOTE => in_quotes = !in_quotes,
-            // Everything else is always taken literally.
-            _ => cur.push(w),
-        }
-    }
-    // Push the final argument, if any.
-    if !cur.is_empty() || in_quotes {
-        ret_val.push(OsString::from(cur));
-    }
-    Some(ret_val)
-}
diff --git a/library/std/src/sys/pal/uefi/mod.rs b/library/std/src/sys/pal/uefi/mod.rs
index 9760a23084a..cd901f48b76 100644
--- a/library/std/src/sys/pal/uefi/mod.rs
+++ b/library/std/src/sys/pal/uefi/mod.rs
@@ -13,7 +13,6 @@
 //! [`OsString`]: crate::ffi::OsString
 #![forbid(unsafe_op_in_unsafe_fn)]
 
-pub mod args;
 pub mod env;
 pub mod helpers;
 pub mod os;
diff --git a/library/std/src/sys/pal/unix/args.rs b/library/std/src/sys/pal/unix/args.rs
deleted file mode 100644
index 0bb7b64007a..00000000000
--- a/library/std/src/sys/pal/unix/args.rs
+++ /dev/null
@@ -1,243 +0,0 @@
-//! Global initialization and retrieval of command line arguments.
-//!
-//! On some platforms these are stored during runtime startup,
-//! and on some they are retrieved from the system on demand.
-
-#![allow(dead_code)] // runtime init functions not used during testing
-
-use crate::ffi::{CStr, OsString};
-use crate::os::unix::ffi::OsStringExt;
-use crate::{fmt, vec};
-
-/// One-time global initialization.
-pub unsafe fn init(argc: isize, argv: *const *const u8) {
-    imp::init(argc, argv)
-}
-
-/// Returns the command line arguments
-pub fn args() -> Args {
-    let (argc, argv) = imp::argc_argv();
-
-    let mut vec = Vec::with_capacity(argc as usize);
-
-    for i in 0..argc {
-        // SAFETY: `argv` is non-null if `argc` is positive, and it is
-        // guaranteed to be at least as long as `argc`, so reading from it
-        // should be safe.
-        let ptr = unsafe { argv.offset(i).read() };
-
-        // Some C commandline parsers (e.g. GLib and Qt) are replacing already
-        // handled arguments in `argv` with `NULL` and move them to the end.
-        //
-        // Since they can't directly ensure updates to `argc` as well, this
-        // means that `argc` might be bigger than the actual number of
-        // non-`NULL` pointers in `argv` at this point.
-        //
-        // To handle this we simply stop iterating at the first `NULL`
-        // argument. `argv` is also guaranteed to be `NULL`-terminated so any
-        // non-`NULL` arguments after the first `NULL` can safely be ignored.
-        if ptr.is_null() {
-            // NOTE: On Apple platforms, `-[NSProcessInfo arguments]` does not
-            // stop iterating here, but instead `continue`, always iterating
-            // up until it reached `argc`.
-            //
-            // This difference will only matter in very specific circumstances
-            // where `argc`/`argv` have been modified, but in unexpected ways,
-            // so it likely doesn't really matter which option we choose.
-            // See the following PR for further discussion:
-            // <https://github.com/rust-lang/rust/pull/125225>
-            break;
-        }
-
-        // SAFETY: Just checked that the pointer is not NULL, and arguments
-        // are otherwise guaranteed to be valid C strings.
-        let cstr = unsafe { CStr::from_ptr(ptr) };
-        vec.push(OsStringExt::from_vec(cstr.to_bytes().to_vec()));
-    }
-
-    Args { iter: vec.into_iter() }
-}
-
-pub struct Args {
-    iter: vec::IntoIter<OsString>,
-}
-
-impl !Send for Args {}
-impl !Sync for Args {}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.iter.as_slice().fmt(f)
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        self.iter.next()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.iter.size_hint()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.iter.len()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.iter.next_back()
-    }
-}
-
-#[cfg(any(
-    target_os = "linux",
-    target_os = "android",
-    target_os = "freebsd",
-    target_os = "dragonfly",
-    target_os = "netbsd",
-    target_os = "openbsd",
-    target_os = "cygwin",
-    target_os = "solaris",
-    target_os = "illumos",
-    target_os = "emscripten",
-    target_os = "haiku",
-    target_os = "l4re",
-    target_os = "fuchsia",
-    target_os = "redox",
-    target_os = "vxworks",
-    target_os = "horizon",
-    target_os = "aix",
-    target_os = "nto",
-    target_os = "hurd",
-    target_os = "rtems",
-    target_os = "nuttx",
-))]
-mod imp {
-    use crate::ffi::c_char;
-    use crate::ptr;
-    use crate::sync::atomic::{AtomicIsize, AtomicPtr, Ordering};
-
-    // The system-provided argc and argv, which we store in static memory
-    // here so that we can defer the work of parsing them until its actually
-    // needed.
-    //
-    // Note that we never mutate argv/argc, the argv array, or the argv
-    // strings, which allows the code in this file to be very simple.
-    static ARGC: AtomicIsize = AtomicIsize::new(0);
-    static ARGV: AtomicPtr<*const u8> = AtomicPtr::new(ptr::null_mut());
-
-    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.
-        ARGC.store(argc, Ordering::Relaxed);
-        ARGV.store(argv as *mut _, Ordering::Relaxed);
-    }
-
-    #[inline(always)]
-    pub unsafe fn init(argc: isize, argv: *const *const u8) {
-        // on GNU/Linux if we are main then we will init argv and argc twice, it "duplicates work"
-        // BUT edge-cases are real: only using .init_array can break most emulators, dlopen, etc.
-        really_init(argc, argv);
-    }
-
-    /// glibc passes argc, argv, and envp to functions in .init_array, as a non-standard extension.
-    /// This allows `std::env::args` to work even in a `cdylib`, as it does on macOS and Windows.
-    #[cfg(all(target_os = "linux", target_env = "gnu"))]
-    #[used]
-    #[unsafe(link_section = ".init_array.00099")]
-    static ARGV_INIT_ARRAY: extern "C" fn(
-        crate::os::raw::c_int,
-        *const *const u8,
-        *const *const u8,
-    ) = {
-        extern "C" fn init_wrapper(
-            argc: crate::os::raw::c_int,
-            argv: *const *const u8,
-            _envp: *const *const u8,
-        ) {
-            unsafe {
-                really_init(argc as isize, argv);
-            }
-        }
-        init_wrapper
-    };
-
-    pub fn argc_argv() -> (isize, *const *const c_char) {
-        // Load ARGC and ARGV, which hold the unmodified system-provided
-        // argc/argv, so we can read the pointed-to memory without atomics or
-        // synchronization.
-        //
-        // If either ARGC or ARGV is still zero or null, then either there
-        // really are no arguments, or someone is asking for `args()` before
-        // initialization has completed, and we return an empty list.
-        let argv = ARGV.load(Ordering::Relaxed);
-        let argc = if argv.is_null() { 0 } else { ARGC.load(Ordering::Relaxed) };
-
-        // Cast from `*mut *const u8` to `*const *const c_char`
-        (argc, argv.cast())
-    }
-}
-
-// Use `_NSGetArgc` and `_NSGetArgv` on Apple platforms.
-//
-// Even though these have underscores in their names, they've been available
-// since the first versions of both macOS and iOS, and are declared in
-// the header `crt_externs.h`.
-//
-// NOTE: This header was added to the iOS 13.0 SDK, which has been the source
-// of a great deal of confusion in the past about the availability of these
-// APIs.
-//
-// NOTE(madsmtm): This has not strictly been verified to not cause App Store
-// rejections; if this is found to be the case, the previous implementation
-// of this used `[[NSProcessInfo processInfo] arguments]`.
-#[cfg(target_vendor = "apple")]
-mod imp {
-    use crate::ffi::{c_char, c_int};
-
-    pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
-        // No need to initialize anything in here, `libdyld.dylib` has already
-        // done the work for us.
-    }
-
-    pub fn argc_argv() -> (isize, *const *const c_char) {
-        unsafe extern "C" {
-            // These functions are in crt_externs.h.
-            fn _NSGetArgc() -> *mut c_int;
-            fn _NSGetArgv() -> *mut *mut *mut c_char;
-        }
-
-        // SAFETY: The returned pointer points to a static initialized early
-        // in the program lifetime by `libdyld.dylib`, and as such is always
-        // valid.
-        //
-        // NOTE: Similar to `_NSGetEnviron`, there technically isn't anything
-        // protecting us against concurrent modifications to this, and there
-        // doesn't exist a lock that we can take. Instead, it is generally
-        // expected that it's only modified in `main` / before other code
-        // runs, so reading this here should be fine.
-        let argc = unsafe { _NSGetArgc().read() };
-        // SAFETY: Same as above.
-        let argv = unsafe { _NSGetArgv().read() };
-
-        // Cast from `*mut *mut c_char` to `*const *const c_char`
-        (argc as isize, argv.cast())
-    }
-}
-
-#[cfg(any(target_os = "espidf", target_os = "vita"))]
-mod imp {
-    use crate::ffi::c_char;
-    use crate::ptr;
-
-    #[inline(always)]
-    pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
-
-    pub fn argc_argv() -> (isize, *const *const c_char) {
-        (0, ptr::null())
-    }
-}
diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs
index d7106c33974..3a790d9c868 100644
--- a/library/std/src/sys/pal/unix/mod.rs
+++ b/library/std/src/sys/pal/unix/mod.rs
@@ -6,7 +6,6 @@ use crate::io::ErrorKind;
 #[macro_use]
 pub mod weak;
 
-pub mod args;
 pub mod env;
 #[cfg(target_os = "fuchsia")]
 pub mod fuchsia;
@@ -27,6 +26,7 @@ pub mod time;
 pub fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
 
 #[cfg(not(target_os = "espidf"))]
+#[cfg_attr(target_os = "vita", allow(unused_variables))]
 // SAFETY: must be called only once during runtime initialization.
 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
 // See `fn init()` in `library/std/src/rt.rs` for docs on `sigpipe`.
@@ -47,7 +47,8 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
     reset_sigpipe(sigpipe);
 
     stack_overflow::init();
-    args::init(argc, argv);
+    #[cfg(not(target_os = "vita"))]
+    crate::sys::args::init(argc, argv);
 
     // Normally, `thread::spawn` will call `Thread::set_name` but since this thread
     // already exists, we have to call it ourselves. We only do this on Apple targets
@@ -273,6 +274,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
         libc::ETXTBSY => ExecutableFileBusy,
         libc::EXDEV => CrossesDevices,
         libc::EINPROGRESS => InProgress,
+        libc::EOPNOTSUPP => Unsupported,
 
         libc::EACCES | libc::EPERM => PermissionDenied,
 
diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs
index 9078dd1c231..4cdc2eaf0e5 100644
--- a/library/std/src/sys/pal/unix/thread.rs
+++ b/library/std/src/sys/pal/unix/thread.rs
@@ -8,14 +8,19 @@ use crate::sys::weak::weak;
 use crate::sys::{os, stack_overflow};
 use crate::time::Duration;
 use crate::{cmp, io, ptr};
-#[cfg(not(any(target_os = "l4re", target_os = "vxworks", target_os = "espidf")))]
+#[cfg(not(any(
+    target_os = "l4re",
+    target_os = "vxworks",
+    target_os = "espidf",
+    target_os = "nuttx"
+)))]
 pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024;
 #[cfg(target_os = "l4re")]
 pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024;
 #[cfg(target_os = "vxworks")]
 pub const DEFAULT_MIN_STACK_SIZE: usize = 256 * 1024;
-#[cfg(target_os = "espidf")]
-pub const DEFAULT_MIN_STACK_SIZE: usize = 0; // 0 indicates that the stack size configured in the ESP-IDF menuconfig system should be used
+#[cfg(any(target_os = "espidf", target_os = "nuttx"))]
+pub const DEFAULT_MIN_STACK_SIZE: usize = 0; // 0 indicates that the stack size configured in the ESP-IDF/NuttX menuconfig system should be used
 
 #[cfg(target_os = "fuchsia")]
 mod zircon {
@@ -52,10 +57,10 @@ impl Thread {
         let mut attr: mem::MaybeUninit<libc::pthread_attr_t> = mem::MaybeUninit::uninit();
         assert_eq!(libc::pthread_attr_init(attr.as_mut_ptr()), 0);
 
-        #[cfg(target_os = "espidf")]
+        #[cfg(any(target_os = "espidf", target_os = "nuttx"))]
         if stack > 0 {
             // Only set the stack if a non-zero value is passed
-            // 0 is used as an indication that the default stack size configured in the ESP-IDF menuconfig system should be used
+            // 0 is used as an indication that the default stack size configured in the ESP-IDF/NuttX menuconfig system should be used
             assert_eq!(
                 libc::pthread_attr_setstacksize(
                     attr.as_mut_ptr(),
@@ -65,7 +70,7 @@ impl Thread {
             );
         }
 
-        #[cfg(not(target_os = "espidf"))]
+        #[cfg(not(any(target_os = "espidf", target_os = "nuttx")))]
         {
             let stack_size = cmp::max(stack, min_stack_size(attr.as_ptr()));
 
@@ -189,9 +194,6 @@ impl Thread {
     }
 
     #[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "nto"))]
-    // FIXME(#115199): Rust currently omits weak function definitions
-    // and its metadata from LLVM IR.
-    #[no_sanitize(cfi)]
     pub fn set_name(name: &CStr) {
         weak!(
             fn pthread_setname_np(
diff --git a/library/std/src/sys/pal/unix/time.rs b/library/std/src/sys/pal/unix/time.rs
index b8469b1681f..0074d767474 100644
--- a/library/std/src/sys/pal/unix/time.rs
+++ b/library/std/src/sys/pal/unix/time.rs
@@ -96,17 +96,6 @@ impl Timespec {
         }
     }
 
-    // FIXME(#115199): Rust currently omits weak function definitions
-    // and its metadata from LLVM IR.
-    #[cfg_attr(
-        all(
-            target_os = "linux",
-            target_env = "gnu",
-            target_pointer_width = "32",
-            not(target_arch = "riscv32")
-        ),
-        no_sanitize(cfi)
-    )]
     pub fn now(clock: libc::clockid_t) -> Timespec {
         use crate::mem::MaybeUninit;
         use crate::sys::cvt;
diff --git a/library/std/src/sys/pal/unix/weak.rs b/library/std/src/sys/pal/unix/weak.rs
index e4c814fba8c..a034995e652 100644
--- a/library/std/src/sys/pal/unix/weak.rs
+++ b/library/std/src/sys/pal/unix/weak.rs
@@ -155,9 +155,6 @@ unsafe fn fetch(name: &str) -> *mut libc::c_void {
 #[cfg(not(any(target_os = "linux", target_os = "android")))]
 pub(crate) macro syscall {
     (fn $name:ident($($param:ident : $t:ty),* $(,)?) -> $ret:ty;) => (
-        // FIXME(#115199): Rust currently omits weak function definitions
-        // and its metadata from LLVM IR.
-        #[no_sanitize(cfi)]
         unsafe fn $name($($param: $t),*) -> $ret {
             weak!(fn $name($($param: $t),*) -> $ret;);
 
diff --git a/library/std/src/sys/pal/unsupported/args.rs b/library/std/src/sys/pal/unsupported/args.rs
deleted file mode 100644
index a2d75a61976..00000000000
--- a/library/std/src/sys/pal/unsupported/args.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use crate::ffi::OsString;
-use crate::fmt;
-
-pub struct Args {}
-
-pub fn args() -> Args {
-    Args {}
-}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.debug_list().finish()
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        None
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        (0, Some(0))
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        0
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        None
-    }
-}
diff --git a/library/std/src/sys/pal/unsupported/mod.rs b/library/std/src/sys/pal/unsupported/mod.rs
index 38838b915b5..dea42a95dcc 100644
--- a/library/std/src/sys/pal/unsupported/mod.rs
+++ b/library/std/src/sys/pal/unsupported/mod.rs
@@ -1,6 +1,5 @@
 #![deny(unsafe_op_in_unsafe_fn)]
 
-pub mod args;
 pub mod env;
 pub mod os;
 pub mod pipe;
diff --git a/library/std/src/sys/pal/wasi/args.rs b/library/std/src/sys/pal/wasi/args.rs
deleted file mode 100644
index 52cfa202af8..00000000000
--- a/library/std/src/sys/pal/wasi/args.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#![forbid(unsafe_op_in_unsafe_fn)]
-
-use crate::ffi::{CStr, OsStr, OsString};
-use crate::os::wasi::ffi::OsStrExt;
-use crate::{fmt, vec};
-
-pub struct Args {
-    iter: vec::IntoIter<OsString>,
-}
-
-impl !Send for Args {}
-impl !Sync for Args {}
-
-/// Returns the command line arguments
-pub fn args() -> Args {
-    Args { iter: maybe_args().unwrap_or(Vec::new()).into_iter() }
-}
-
-fn maybe_args() -> Option<Vec<OsString>> {
-    unsafe {
-        let (argc, buf_size) = wasi::args_sizes_get().ok()?;
-        let mut argv = Vec::with_capacity(argc);
-        let mut buf = Vec::with_capacity(buf_size);
-        wasi::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?;
-        argv.set_len(argc);
-        let mut ret = Vec::with_capacity(argc);
-        for ptr in argv {
-            let s = CStr::from_ptr(ptr.cast());
-            ret.push(OsStr::from_bytes(s.to_bytes()).to_owned());
-        }
-        Some(ret)
-    }
-}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.iter.as_slice().fmt(f)
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        self.iter.next()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.iter.size_hint()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.iter.len()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.iter.next_back()
-    }
-}
diff --git a/library/std/src/sys/pal/wasi/mod.rs b/library/std/src/sys/pal/wasi/mod.rs
index 80853e7b5a2..4ea42b1082b 100644
--- a/library/std/src/sys/pal/wasi/mod.rs
+++ b/library/std/src/sys/pal/wasi/mod.rs
@@ -13,7 +13,6 @@
 //! compiling for wasm. That way it's a compile time error for something that's
 //! guaranteed to be a runtime error!
 
-pub mod args;
 pub mod env;
 #[allow(unused)]
 #[path = "../wasm/atomics/futex.rs"]
diff --git a/library/std/src/sys/pal/wasip2/mod.rs b/library/std/src/sys/pal/wasip2/mod.rs
index 504b947d09e..6445bf2cc0d 100644
--- a/library/std/src/sys/pal/wasip2/mod.rs
+++ b/library/std/src/sys/pal/wasip2/mod.rs
@@ -6,8 +6,6 @@
 //! To begin with, this target mirrors the wasi target 1 to 1, but over
 //! time this will change significantly.
 
-#[path = "../wasi/args.rs"]
-pub mod args;
 #[path = "../wasi/env.rs"]
 pub mod env;
 #[allow(unused)]
diff --git a/library/std/src/sys/pal/wasm/mod.rs b/library/std/src/sys/pal/wasm/mod.rs
index 8d39b70d039..af370020d96 100644
--- a/library/std/src/sys/pal/wasm/mod.rs
+++ b/library/std/src/sys/pal/wasm/mod.rs
@@ -16,8 +16,6 @@
 
 #![deny(unsafe_op_in_unsafe_fn)]
 
-#[path = "../unsupported/args.rs"]
-pub mod args;
 pub mod env;
 #[path = "../unsupported/os.rs"]
 pub mod os;
diff --git a/library/std/src/sys/pal/windows/args.rs b/library/std/src/sys/pal/windows/args.rs
deleted file mode 100644
index d973743639a..00000000000
--- a/library/std/src/sys/pal/windows/args.rs
+++ /dev/null
@@ -1,445 +0,0 @@
-//! The Windows command line is just a string
-//! <https://docs.microsoft.com/en-us/archive/blogs/larryosterman/the-windows-command-line-is-just-a-string>
-//!
-//! This module implements the parsing necessary to turn that string into a list of arguments.
-
-#[cfg(test)]
-mod tests;
-
-use super::ensure_no_nuls;
-use super::os::current_exe;
-use crate::ffi::{OsStr, OsString};
-use crate::num::NonZero;
-use crate::os::windows::prelude::*;
-use crate::path::{Path, PathBuf};
-use crate::sys::path::get_long_path;
-use crate::sys::{c, to_u16s};
-use crate::sys_common::AsInner;
-use crate::sys_common::wstr::WStrUnits;
-use crate::{fmt, io, iter, vec};
-
-pub fn args() -> Args {
-    // SAFETY: `GetCommandLineW` returns a pointer to a null terminated UTF-16
-    // string so it's safe for `WStrUnits` to use.
-    unsafe {
-        let lp_cmd_line = c::GetCommandLineW();
-        let parsed_args_list = parse_lp_cmd_line(WStrUnits::new(lp_cmd_line), || {
-            current_exe().map(PathBuf::into_os_string).unwrap_or_else(|_| OsString::new())
-        });
-
-        Args { parsed_args_list: parsed_args_list.into_iter() }
-    }
-}
-
-/// Implements the Windows command-line argument parsing algorithm.
-///
-/// Microsoft's documentation for the Windows CLI argument format can be found at
-/// <https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-160#parsing-c-command-line-arguments>
-///
-/// A more in-depth explanation is here:
-/// <https://daviddeley.com/autohotkey/parameters/parameters.htm#WIN>
-///
-/// Windows includes a function to do command line parsing in shell32.dll.
-/// However, this is not used for two reasons:
-///
-/// 1. Linking with that DLL causes the process to be registered as a GUI application.
-/// GUI applications add a bunch of overhead, even if no windows are drawn. See
-/// <https://randomascii.wordpress.com/2018/12/03/a-not-called-function-can-cause-a-5x-slowdown/>.
-///
-/// 2. It does not follow the modern C/C++ argv rules outlined in the first two links above.
-///
-/// This function was tested for equivalence to the C/C++ parsing rules using an
-/// extensive test suite available at
-/// <https://github.com/ChrisDenton/winarg/tree/std>.
-fn parse_lp_cmd_line<'a, F: Fn() -> OsString>(
-    lp_cmd_line: Option<WStrUnits<'a>>,
-    exe_name: F,
-) -> Vec<OsString> {
-    const BACKSLASH: NonZero<u16> = NonZero::new(b'\\' as u16).unwrap();
-    const QUOTE: NonZero<u16> = NonZero::new(b'"' as u16).unwrap();
-    const TAB: NonZero<u16> = NonZero::new(b'\t' as u16).unwrap();
-    const SPACE: NonZero<u16> = NonZero::new(b' ' as u16).unwrap();
-
-    let mut ret_val = Vec::new();
-    // If the cmd line pointer is null or it points to an empty string then
-    // return the name of the executable as argv[0].
-    if lp_cmd_line.as_ref().and_then(|cmd| cmd.peek()).is_none() {
-        ret_val.push(exe_name());
-        return ret_val;
-    }
-    let mut code_units = lp_cmd_line.unwrap();
-
-    // The executable name at the beginning is special.
-    let mut in_quotes = false;
-    let mut cur = Vec::new();
-    for w in &mut code_units {
-        match w {
-            // A quote mark always toggles `in_quotes` no matter what because
-            // there are no escape characters when parsing the executable name.
-            QUOTE => in_quotes = !in_quotes,
-            // If not `in_quotes` then whitespace ends argv[0].
-            SPACE | TAB if !in_quotes => break,
-            // In all other cases the code unit is taken literally.
-            _ => cur.push(w.get()),
-        }
-    }
-    // Skip whitespace.
-    code_units.advance_while(|w| w == SPACE || w == TAB);
-    ret_val.push(OsString::from_wide(&cur));
-
-    // Parse the arguments according to these rules:
-    // * All code units are taken literally except space, tab, quote and backslash.
-    // * When not `in_quotes`, space and tab separate arguments. Consecutive spaces and tabs are
-    // treated as a single separator.
-    // * A space or tab `in_quotes` is taken literally.
-    // * A quote toggles `in_quotes` mode unless it's escaped. An escaped quote is taken literally.
-    // * A quote can be escaped if preceded by an odd number of backslashes.
-    // * If any number of backslashes is immediately followed by a quote then the number of
-    // backslashes is halved (rounding down).
-    // * Backslashes not followed by a quote are all taken literally.
-    // * If `in_quotes` then a quote can also be escaped using another quote
-    // (i.e. two consecutive quotes become one literal quote).
-    let mut cur = Vec::new();
-    let mut in_quotes = false;
-    while let Some(w) = code_units.next() {
-        match w {
-            // If not `in_quotes`, a space or tab ends the argument.
-            SPACE | TAB if !in_quotes => {
-                ret_val.push(OsString::from_wide(&cur[..]));
-                cur.truncate(0);
-
-                // Skip whitespace.
-                code_units.advance_while(|w| w == SPACE || w == TAB);
-            }
-            // Backslashes can escape quotes or backslashes but only if consecutive backslashes are followed by a quote.
-            BACKSLASH => {
-                let backslash_count = code_units.advance_while(|w| w == BACKSLASH) + 1;
-                if code_units.peek() == Some(QUOTE) {
-                    cur.extend(iter::repeat(BACKSLASH.get()).take(backslash_count / 2));
-                    // The quote is escaped if there are an odd number of backslashes.
-                    if backslash_count % 2 == 1 {
-                        code_units.next();
-                        cur.push(QUOTE.get());
-                    }
-                } else {
-                    // If there is no quote on the end then there is no escaping.
-                    cur.extend(iter::repeat(BACKSLASH.get()).take(backslash_count));
-                }
-            }
-            // If `in_quotes` and not backslash escaped (see above) then a quote either
-            // unsets `in_quote` or is escaped by another quote.
-            QUOTE if in_quotes => match code_units.peek() {
-                // Two consecutive quotes when `in_quotes` produces one literal quote.
-                Some(QUOTE) => {
-                    cur.push(QUOTE.get());
-                    code_units.next();
-                }
-                // Otherwise set `in_quotes`.
-                Some(_) => in_quotes = false,
-                // The end of the command line.
-                // Push `cur` even if empty, which we do by breaking while `in_quotes` is still set.
-                None => break,
-            },
-            // If not `in_quotes` and not BACKSLASH escaped (see above) then a quote sets `in_quote`.
-            QUOTE => in_quotes = true,
-            // Everything else is always taken literally.
-            _ => cur.push(w.get()),
-        }
-    }
-    // Push the final argument, if any.
-    if !cur.is_empty() || in_quotes {
-        ret_val.push(OsString::from_wide(&cur[..]));
-    }
-    ret_val
-}
-
-pub struct Args {
-    parsed_args_list: vec::IntoIter<OsString>,
-}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.parsed_args_list.as_slice().fmt(f)
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        self.parsed_args_list.next()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.parsed_args_list.size_hint()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.parsed_args_list.next_back()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.parsed_args_list.len()
-    }
-}
-
-#[derive(Debug)]
-pub(crate) enum Arg {
-    /// Add quotes (if needed)
-    Regular(OsString),
-    /// Append raw string without quoting
-    Raw(OsString),
-}
-
-enum Quote {
-    // Every arg is quoted
-    Always,
-    // Whitespace and empty args are quoted
-    Auto,
-    // Arg appended without any changes (#29494)
-    Never,
-}
-
-pub(crate) fn append_arg(cmd: &mut Vec<u16>, arg: &Arg, force_quotes: bool) -> io::Result<()> {
-    let (arg, quote) = match arg {
-        Arg::Regular(arg) => (arg, if force_quotes { Quote::Always } else { Quote::Auto }),
-        Arg::Raw(arg) => (arg, Quote::Never),
-    };
-
-    // If an argument has 0 characters then we need to quote it to ensure
-    // that it actually gets passed through on the command line or otherwise
-    // it will be dropped entirely when parsed on the other end.
-    ensure_no_nuls(arg)?;
-    let arg_bytes = arg.as_encoded_bytes();
-    let (quote, escape) = match quote {
-        Quote::Always => (true, true),
-        Quote::Auto => {
-            (arg_bytes.iter().any(|c| *c == b' ' || *c == b'\t') || arg_bytes.is_empty(), true)
-        }
-        Quote::Never => (false, false),
-    };
-    if quote {
-        cmd.push('"' as u16);
-    }
-
-    let mut backslashes: usize = 0;
-    for x in arg.encode_wide() {
-        if escape {
-            if x == '\\' as u16 {
-                backslashes += 1;
-            } else {
-                if x == '"' as u16 {
-                    // Add n+1 backslashes to total 2n+1 before internal '"'.
-                    cmd.extend((0..=backslashes).map(|_| '\\' as u16));
-                }
-                backslashes = 0;
-            }
-        }
-        cmd.push(x);
-    }
-
-    if quote {
-        // Add n backslashes to total 2n before ending '"'.
-        cmd.extend((0..backslashes).map(|_| '\\' as u16));
-        cmd.push('"' as u16);
-    }
-    Ok(())
-}
-
-fn append_bat_arg(cmd: &mut Vec<u16>, arg: &OsStr, mut quote: bool) -> io::Result<()> {
-    ensure_no_nuls(arg)?;
-    // If an argument has 0 characters then we need to quote it to ensure
-    // that it actually gets passed through on the command line or otherwise
-    // it will be dropped entirely when parsed on the other end.
-    //
-    // We also need to quote the argument if it ends with `\` to guard against
-    // bat usage such as `"%~2"` (i.e. force quote arguments) otherwise a
-    // trailing slash will escape the closing quote.
-    if arg.is_empty() || arg.as_encoded_bytes().last() == Some(&b'\\') {
-        quote = true;
-    }
-    for cp in arg.as_inner().inner.code_points() {
-        if let Some(cp) = cp.to_char() {
-            // Rather than trying to find every ascii symbol that must be quoted,
-            // we assume that all ascii symbols must be quoted unless they're known to be good.
-            // We also quote Unicode control blocks for good measure.
-            // Note an unquoted `\` is fine so long as the argument isn't otherwise quoted.
-            static UNQUOTED: &str = r"#$*+-./:?@\_";
-            let ascii_needs_quotes =
-                cp.is_ascii() && !(cp.is_ascii_alphanumeric() || UNQUOTED.contains(cp));
-            if ascii_needs_quotes || cp.is_control() {
-                quote = true;
-            }
-        }
-    }
-
-    if quote {
-        cmd.push('"' as u16);
-    }
-    // Loop through the string, escaping `\` only if followed by `"`.
-    // And escaping `"` by doubling them.
-    let mut backslashes: usize = 0;
-    for x in arg.encode_wide() {
-        if x == '\\' as u16 {
-            backslashes += 1;
-        } else {
-            if x == '"' as u16 {
-                // Add n backslashes to total 2n before internal `"`.
-                cmd.extend((0..backslashes).map(|_| '\\' as u16));
-                // Appending an additional double-quote acts as an escape.
-                cmd.push(b'"' as u16)
-            } else if x == '%' as u16 || x == '\r' as u16 {
-                // yt-dlp hack: replaces `%` with `%%cd:~,%` to stop %VAR% being expanded as an environment variable.
-                //
-                // # Explanation
-                //
-                // cmd supports extracting a substring from a variable using the following syntax:
-                //     %variable:~start_index,end_index%
-                //
-                // In the above command `cd` is used as the variable and the start_index and end_index are left blank.
-                // `cd` is a built-in variable that dynamically expands to the current directory so it's always available.
-                // Explicitly omitting both the start and end index creates a zero-length substring.
-                //
-                // Therefore it all resolves to nothing. However, by doing this no-op we distract cmd.exe
-                // from potentially expanding %variables% in the argument.
-                cmd.extend_from_slice(&[
-                    '%' as u16, '%' as u16, 'c' as u16, 'd' as u16, ':' as u16, '~' as u16,
-                    ',' as u16,
-                ]);
-            }
-            backslashes = 0;
-        }
-        cmd.push(x);
-    }
-    if quote {
-        // Add n backslashes to total 2n before ending `"`.
-        cmd.extend((0..backslashes).map(|_| '\\' as u16));
-        cmd.push('"' as u16);
-    }
-    Ok(())
-}
-
-pub(crate) fn make_bat_command_line(
-    script: &[u16],
-    args: &[Arg],
-    force_quotes: bool,
-) -> io::Result<Vec<u16>> {
-    const INVALID_ARGUMENT_ERROR: io::Error =
-        io::const_error!(io::ErrorKind::InvalidInput, r#"batch file arguments are invalid"#);
-    // Set the start of the command line to `cmd.exe /c "`
-    // It is necessary to surround the command in an extra pair of quotes,
-    // hence the trailing quote here. It will be closed after all arguments
-    // have been added.
-    // Using /e:ON enables "command extensions" which is essential for the `%` hack to work.
-    let mut cmd: Vec<u16> = "cmd.exe /e:ON /v:OFF /d /c \"".encode_utf16().collect();
-
-    // Push the script name surrounded by its quote pair.
-    cmd.push(b'"' as u16);
-    // Windows file names cannot contain a `"` character or end with `\\`.
-    // If the script name does then return an error.
-    if script.contains(&(b'"' as u16)) || script.last() == Some(&(b'\\' as u16)) {
-        return Err(io::const_error!(
-            io::ErrorKind::InvalidInput,
-            "Windows file names may not contain `\"` or end with `\\`"
-        ));
-    }
-    cmd.extend_from_slice(script.strip_suffix(&[0]).unwrap_or(script));
-    cmd.push(b'"' as u16);
-
-    // Append the arguments.
-    // FIXME: This needs tests to ensure that the arguments are properly
-    // reconstructed by the batch script by default.
-    for arg in args {
-        cmd.push(' ' as u16);
-        match arg {
-            Arg::Regular(arg_os) => {
-                let arg_bytes = arg_os.as_encoded_bytes();
-                // Disallow \r and \n as they may truncate the arguments.
-                const DISALLOWED: &[u8] = b"\r\n";
-                if arg_bytes.iter().any(|c| DISALLOWED.contains(c)) {
-                    return Err(INVALID_ARGUMENT_ERROR);
-                }
-                append_bat_arg(&mut cmd, arg_os, force_quotes)?;
-            }
-            _ => {
-                // Raw arguments are passed on as-is.
-                // It's the user's responsibility to properly handle arguments in this case.
-                append_arg(&mut cmd, arg, force_quotes)?;
-            }
-        };
-    }
-
-    // Close the quote we left opened earlier.
-    cmd.push(b'"' as u16);
-
-    Ok(cmd)
-}
-
-/// Takes a path and tries to return a non-verbatim path.
-///
-/// This is necessary because cmd.exe does not support verbatim paths.
-pub(crate) fn to_user_path(path: &Path) -> io::Result<Vec<u16>> {
-    from_wide_to_user_path(to_u16s(path)?)
-}
-pub(crate) fn from_wide_to_user_path(mut path: Vec<u16>) -> io::Result<Vec<u16>> {
-    use super::fill_utf16_buf;
-    use crate::ptr;
-
-    // UTF-16 encoded code points, used in parsing and building UTF-16 paths.
-    // All of these are in the ASCII range so they can be cast directly to `u16`.
-    const SEP: u16 = b'\\' as _;
-    const QUERY: u16 = b'?' as _;
-    const COLON: u16 = b':' as _;
-    const U: u16 = b'U' as _;
-    const N: u16 = b'N' as _;
-    const C: u16 = b'C' as _;
-
-    // Early return if the path is too long to remove the verbatim prefix.
-    const LEGACY_MAX_PATH: usize = 260;
-    if path.len() > LEGACY_MAX_PATH {
-        return Ok(path);
-    }
-
-    match &path[..] {
-        // `\\?\C:\...` => `C:\...`
-        [SEP, SEP, QUERY, SEP, _, COLON, SEP, ..] => unsafe {
-            let lpfilename = path[4..].as_ptr();
-            fill_utf16_buf(
-                |buffer, size| c::GetFullPathNameW(lpfilename, size, buffer, ptr::null_mut()),
-                |full_path: &[u16]| {
-                    if full_path == &path[4..path.len() - 1] {
-                        let mut path: Vec<u16> = full_path.into();
-                        path.push(0);
-                        path
-                    } else {
-                        path
-                    }
-                },
-            )
-        },
-        // `\\?\UNC\...` => `\\...`
-        [SEP, SEP, QUERY, SEP, U, N, C, SEP, ..] => unsafe {
-            // Change the `C` in `UNC\` to `\` so we can get a slice that starts with `\\`.
-            path[6] = b'\\' as u16;
-            let lpfilename = path[6..].as_ptr();
-            fill_utf16_buf(
-                |buffer, size| c::GetFullPathNameW(lpfilename, size, buffer, ptr::null_mut()),
-                |full_path: &[u16]| {
-                    if full_path == &path[6..path.len() - 1] {
-                        let mut path: Vec<u16> = full_path.into();
-                        path.push(0);
-                        path
-                    } else {
-                        // Restore the 'C' in "UNC".
-                        path[6] = b'C' as u16;
-                        path
-                    }
-                },
-            )
-        },
-        // For everything else, leave the path unchanged.
-        _ => get_long_path(path, false),
-    }
-}
diff --git a/library/std/src/sys/pal/windows/args/tests.rs b/library/std/src/sys/pal/windows/args/tests.rs
deleted file mode 100644
index 484a90ab056..00000000000
--- a/library/std/src/sys/pal/windows/args/tests.rs
+++ /dev/null
@@ -1,91 +0,0 @@
-use super::*;
-use crate::ffi::OsString;
-
-fn chk(string: &str, parts: &[&str]) {
-    let mut wide: Vec<u16> = OsString::from(string).encode_wide().collect();
-    wide.push(0);
-    let parsed =
-        unsafe { parse_lp_cmd_line(WStrUnits::new(wide.as_ptr()), || OsString::from("TEST.EXE")) };
-    let expected: Vec<OsString> = parts.iter().map(|k| OsString::from(k)).collect();
-    assert_eq!(parsed.as_slice(), expected.as_slice(), "{:?}", string);
-}
-
-#[test]
-fn empty() {
-    chk("", &["TEST.EXE"]);
-    chk("\0", &["TEST.EXE"]);
-}
-
-#[test]
-fn single_words() {
-    chk("EXE one_word", &["EXE", "one_word"]);
-    chk("EXE a", &["EXE", "a"]);
-    chk("EXE 😅", &["EXE", "😅"]);
-    chk("EXE 😅🤦", &["EXE", "😅🤦"]);
-}
-
-#[test]
-fn official_examples() {
-    chk(r#"EXE "abc" d e"#, &["EXE", "abc", "d", "e"]);
-    chk(r#"EXE a\\\b d"e f"g h"#, &["EXE", r"a\\\b", "de fg", "h"]);
-    chk(r#"EXE a\\\"b c d"#, &["EXE", r#"a\"b"#, "c", "d"]);
-    chk(r#"EXE a\\\\"b c" d e"#, &["EXE", r"a\\b c", "d", "e"]);
-}
-
-#[test]
-fn whitespace_behavior() {
-    chk(" test", &["", "test"]);
-    chk("  test", &["", "test"]);
-    chk(" test test2", &["", "test", "test2"]);
-    chk(" test  test2", &["", "test", "test2"]);
-    chk("test test2 ", &["test", "test2"]);
-    chk("test  test2 ", &["test", "test2"]);
-    chk("test ", &["test"]);
-}
-
-#[test]
-fn genius_quotes() {
-    chk(r#"EXE "" """#, &["EXE", "", ""]);
-    chk(r#"EXE "" """"#, &["EXE", "", r#"""#]);
-    chk(
-        r#"EXE "this is """all""" in the same argument""#,
-        &["EXE", r#"this is "all" in the same argument"#],
-    );
-    chk(r#"EXE "a"""#, &["EXE", r#"a""#]);
-    chk(r#"EXE "a"" a"#, &["EXE", r#"a" a"#]);
-    // quotes cannot be escaped in command names
-    chk(r#""EXE" check"#, &["EXE", "check"]);
-    chk(r#""EXE check""#, &["EXE check"]);
-    chk(r#""EXE """for""" check"#, &["EXE for check"]);
-    chk(r#""EXE \"for\" check"#, &[r"EXE \for\ check"]);
-    chk(r#""EXE \" for \" check"#, &[r"EXE \", "for", r#"""#, "check"]);
-    chk(r#"E"X"E test"#, &["EXE", "test"]);
-    chk(r#"EX""E test"#, &["EXE", "test"]);
-}
-
-// from https://daviddeley.com/autohotkey/parameters/parameters.htm#WINCRULESEX
-#[test]
-fn post_2008() {
-    chk("EXE CallMeIshmael", &["EXE", "CallMeIshmael"]);
-    chk(r#"EXE "Call Me Ishmael""#, &["EXE", "Call Me Ishmael"]);
-    chk(r#"EXE Cal"l Me I"shmael"#, &["EXE", "Call Me Ishmael"]);
-    chk(r#"EXE CallMe\"Ishmael"#, &["EXE", r#"CallMe"Ishmael"#]);
-    chk(r#"EXE "CallMe\"Ishmael""#, &["EXE", r#"CallMe"Ishmael"#]);
-    chk(r#"EXE "Call Me Ishmael\\""#, &["EXE", r"Call Me Ishmael\"]);
-    chk(r#"EXE "CallMe\\\"Ishmael""#, &["EXE", r#"CallMe\"Ishmael"#]);
-    chk(r#"EXE a\\\b"#, &["EXE", r"a\\\b"]);
-    chk(r#"EXE "a\\\b""#, &["EXE", r"a\\\b"]);
-    chk(r#"EXE "\"Call Me Ishmael\"""#, &["EXE", r#""Call Me Ishmael""#]);
-    chk(r#"EXE "C:\TEST A\\""#, &["EXE", r"C:\TEST A\"]);
-    chk(r#"EXE "\"C:\TEST A\\\"""#, &["EXE", r#""C:\TEST A\""#]);
-    chk(r#"EXE "a b c"  d  e"#, &["EXE", "a b c", "d", "e"]);
-    chk(r#"EXE "ab\"c"  "\\"  d"#, &["EXE", r#"ab"c"#, r"\", "d"]);
-    chk(r#"EXE a\\\b d"e f"g h"#, &["EXE", r"a\\\b", "de fg", "h"]);
-    chk(r#"EXE a\\\"b c d"#, &["EXE", r#"a\"b"#, "c", "d"]);
-    chk(r#"EXE a\\\\"b c" d e"#, &["EXE", r"a\\b c", "d", "e"]);
-    // Double Double Quotes
-    chk(r#"EXE "a b c"""#, &["EXE", r#"a b c""#]);
-    chk(r#"EXE """CallMeIshmael"""  b  c"#, &["EXE", r#""CallMeIshmael""#, "b", "c"]);
-    chk(r#"EXE """Call Me Ishmael""""#, &["EXE", r#""Call Me Ishmael""#]);
-    chk(r#"EXE """"Call Me Ishmael"" b c"#, &["EXE", r#""Call"#, "Me", "Ishmael", "b", "c"]);
-}
diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs
index 004cbee52f6..ac1c5e9932e 100644
--- a/library/std/src/sys/pal/windows/c.rs
+++ b/library/std/src/sys/pal/windows/c.rs
@@ -44,8 +44,8 @@ impl UNICODE_STRING {
     }
 }
 
-impl Default for OBJECT_ATTRIBUTES {
-    fn default() -> Self {
+impl OBJECT_ATTRIBUTES {
+    pub fn with_length() -> Self {
         Self {
             Length: size_of::<Self>() as _,
             RootDirectory: ptr::null_mut(),
diff --git a/library/std/src/sys/pal/windows/c/bindings.txt b/library/std/src/sys/pal/windows/c/bindings.txt
index e2c21633279..d5fbb453c6f 100644
--- a/library/std/src/sys/pal/windows/c/bindings.txt
+++ b/library/std/src/sys/pal/windows/c/bindings.txt
@@ -1,7 +1,8 @@
 --out windows_sys.rs
 --flat
 --sys
---no-core
+--no-deps
+--link windows_targets
 --filter
 !INVALID_HANDLE_VALUE
 ABOVE_NORMAL_PRIORITY_CLASS
@@ -19,7 +20,6 @@ ALL_PROCESSOR_GROUPS
 ARM64_NT_NEON128
 BELOW_NORMAL_PRIORITY_CLASS
 bind
-BOOL
 BY_HANDLE_FILE_INFORMATION
 CALLBACK_CHUNK_FINISHED
 CALLBACK_STREAM_SWITCH
diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs
index 1d0e89f5d0f..eb2914b8644 100644
--- a/library/std/src/sys/pal/windows/c/windows_sys.rs
+++ b/library/std/src/sys/pal/windows/c/windows_sys.rs
@@ -1,4 +1,4 @@
-// Bindings generated by `windows-bindgen` 0.59.0
+// Bindings generated by `windows-bindgen` 0.61.0
 
 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)]
 
@@ -141,7 +141,7 @@ windows_targets::link!("ws2_32.dll" "system" fn setsockopt(s : SOCKET, level : i
 windows_targets::link!("ws2_32.dll" "system" fn shutdown(s : SOCKET, how : WINSOCK_SHUTDOWN_HOW) -> i32);
 pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct ACL {
     pub AclRevision: u8,
     pub Sbz1: u8,
@@ -162,6 +162,11 @@ pub struct ADDRINFOA {
     pub ai_addr: *mut SOCKADDR,
     pub ai_next: *mut ADDRINFOA,
 }
+impl Default for ADDRINFOA {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const AF_INET: ADDRESS_FAMILY = 2u16;
 pub const AF_INET6: ADDRESS_FAMILY = 23u16;
 pub const AF_UNIX: u16 = 1u16;
@@ -176,8 +181,13 @@ pub union ARM64_NT_NEON128 {
     pub H: [u16; 8],
     pub B: [u8; 16],
 }
+impl Default for ARM64_NT_NEON128 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct ARM64_NT_NEON128_0 {
     pub Low: u64,
     pub High: i64,
@@ -185,7 +195,7 @@ pub struct ARM64_NT_NEON128_0 {
 pub const BELOW_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 16384u32;
 pub type BOOL = i32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct BY_HANDLE_FILE_INFORMATION {
     pub dwFileAttributes: u32,
     pub ftCreationTime: FILETIME,
@@ -206,9 +216,14 @@ pub type COMPARESTRING_RESULT = i32;
 pub struct CONDITION_VARIABLE {
     pub Ptr: *mut core::ffi::c_void,
 }
+impl Default for CONDITION_VARIABLE {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type CONSOLE_MODE = u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct CONSOLE_READCONSOLE_CONTROL {
     pub nLength: u32,
     pub nInitialChars: u32,
@@ -245,6 +260,12 @@ pub struct CONTEXT {
     pub SegSs: u32,
     pub ExtendedRegisters: [u8; 512],
 }
+#[cfg(target_arch = "x86")]
+impl Default for CONTEXT {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
 #[derive(Clone, Copy)]
@@ -296,6 +317,12 @@ pub struct CONTEXT {
     pub LastExceptionToRip: u64,
     pub LastExceptionFromRip: u64,
 }
+#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
+impl Default for CONTEXT {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
 #[derive(Clone, Copy)]
@@ -303,6 +330,12 @@ pub union CONTEXT_0 {
     pub FltSave: XSAVE_FORMAT,
     pub Anonymous: CONTEXT_0_0,
 }
+#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
+impl Default for CONTEXT_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
 #[derive(Clone, Copy)]
@@ -326,6 +359,12 @@ pub struct CONTEXT_0_0 {
     pub Xmm14: M128A,
     pub Xmm15: M128A,
 }
+#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
+impl Default for CONTEXT_0_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(target_arch = "aarch64")]
 #[derive(Clone, Copy)]
@@ -343,6 +382,12 @@ pub struct CONTEXT {
     pub Wcr: [u32; 2],
     pub Wvr: [u64; 2],
 }
+#[cfg(target_arch = "aarch64")]
+impl Default for CONTEXT {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(target_arch = "aarch64")]
 #[derive(Clone, Copy)]
@@ -350,9 +395,15 @@ pub union CONTEXT_0 {
     pub Anonymous: CONTEXT_0_0,
     pub X: [u64; 31],
 }
+#[cfg(target_arch = "aarch64")]
+impl Default for CONTEXT_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(target_arch = "aarch64")]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct CONTEXT_0_0 {
     pub X0: u64,
     pub X1: u64,
@@ -2305,6 +2356,11 @@ pub struct EXCEPTION_POINTERS {
     pub ExceptionRecord: *mut EXCEPTION_RECORD,
     pub ContextRecord: *mut CONTEXT,
 }
+impl Default for EXCEPTION_POINTERS {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub struct EXCEPTION_RECORD {
@@ -2315,6 +2371,11 @@ pub struct EXCEPTION_RECORD {
     pub NumberParameters: u32,
     pub ExceptionInformation: [usize; 15],
 }
+impl Default for EXCEPTION_RECORD {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = 0xC00000FD_u32 as _;
 pub const EXTENDED_STARTUPINFO_PRESENT: PROCESS_CREATION_FLAGS = 524288u32;
 pub const E_NOTIMPL: HRESULT = 0x80004001_u32 as _;
@@ -2333,8 +2394,13 @@ pub struct FD_SET {
     pub fd_count: u32,
     pub fd_array: [SOCKET; 64],
 }
+impl Default for FD_SET {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILETIME {
     pub dwLowDateTime: u32,
     pub dwHighDateTime: u32,
@@ -2343,7 +2409,7 @@ pub type FILE_ACCESS_RIGHTS = u32;
 pub const FILE_ADD_FILE: FILE_ACCESS_RIGHTS = 2u32;
 pub const FILE_ADD_SUBDIRECTORY: FILE_ACCESS_RIGHTS = 4u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_ALLOCATION_INFO {
     pub AllocationSize: i64,
 }
@@ -2369,7 +2435,7 @@ pub const FILE_ATTRIBUTE_REPARSE_POINT: FILE_FLAGS_AND_ATTRIBUTES = 1024u32;
 pub const FILE_ATTRIBUTE_SPARSE_FILE: FILE_FLAGS_AND_ATTRIBUTES = 512u32;
 pub const FILE_ATTRIBUTE_SYSTEM: FILE_FLAGS_AND_ATTRIBUTES = 4u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_ATTRIBUTE_TAG_INFO {
     pub FileAttributes: u32,
     pub ReparseTag: u32,
@@ -2378,7 +2444,7 @@ pub const FILE_ATTRIBUTE_TEMPORARY: FILE_FLAGS_AND_ATTRIBUTES = 256u32;
 pub const FILE_ATTRIBUTE_UNPINNED: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32;
 pub const FILE_ATTRIBUTE_VIRTUAL: FILE_FLAGS_AND_ATTRIBUTES = 65536u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_BASIC_INFO {
     pub CreationTime: i64,
     pub LastAccessTime: i64,
@@ -2405,19 +2471,19 @@ pub const FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE: FILE_DISPOSITION_INFO
 pub const FILE_DISPOSITION_FLAG_ON_CLOSE: FILE_DISPOSITION_INFO_EX_FLAGS = 8u32;
 pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS = 2u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_DISPOSITION_INFO {
     pub DeleteFile: bool,
 }
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_DISPOSITION_INFO_EX {
     pub Flags: FILE_DISPOSITION_INFO_EX_FLAGS,
 }
 pub type FILE_DISPOSITION_INFO_EX_FLAGS = u32;
 pub const FILE_END: SET_FILE_POINTER_MOVE_METHOD = 2u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_END_OF_FILE_INFO {
     pub EndOfFile: i64,
 }
@@ -2457,9 +2523,14 @@ pub struct FILE_ID_BOTH_DIR_INFO {
     pub FileId: i64,
     pub FileName: [u16; 1],
 }
+impl Default for FILE_ID_BOTH_DIR_INFO {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type FILE_INFO_BY_HANDLE_CLASS = i32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_IO_PRIORITY_HINT_INFO {
     pub PriorityHint: PRIORITY_HINT,
 }
@@ -2494,12 +2565,22 @@ pub struct FILE_RENAME_INFO {
     pub FileNameLength: u32,
     pub FileName: [u16; 1],
 }
+impl Default for FILE_RENAME_INFO {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub union FILE_RENAME_INFO_0 {
     pub ReplaceIfExists: bool,
     pub Flags: u32,
 }
+impl Default for FILE_RENAME_INFO_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const FILE_RESERVE_OPFILTER: NTCREATEFILE_CREATE_OPTIONS = 1048576u32;
 pub const FILE_SEQUENTIAL_ONLY: NTCREATEFILE_CREATE_OPTIONS = 4u32;
 pub const FILE_SESSION_AWARE: NTCREATEFILE_CREATE_OPTIONS = 262144u32;
@@ -2509,7 +2590,7 @@ pub const FILE_SHARE_NONE: FILE_SHARE_MODE = 0u32;
 pub const FILE_SHARE_READ: FILE_SHARE_MODE = 1u32;
 pub const FILE_SHARE_WRITE: FILE_SHARE_MODE = 2u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct FILE_STANDARD_INFO {
     pub AllocationSize: i64,
     pub EndOfFile: i64,
@@ -2549,6 +2630,12 @@ pub struct FLOATING_SAVE_AREA {
     pub RegisterArea: [u8; 80],
     pub Spare0: u32,
 }
+#[cfg(target_arch = "x86")]
+impl Default for FLOATING_SAVE_AREA {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
 #[derive(Clone, Copy)]
@@ -2563,6 +2650,12 @@ pub struct FLOATING_SAVE_AREA {
     pub RegisterArea: [u8; 80],
     pub Cr0NpxState: u32,
 }
+#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
+impl Default for FLOATING_SAVE_AREA {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: FORMAT_MESSAGE_OPTIONS = 256u32;
 pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: FORMAT_MESSAGE_OPTIONS = 8192u32;
 pub const FORMAT_MESSAGE_FROM_HMODULE: FORMAT_MESSAGE_OPTIONS = 2048u32;
@@ -2639,12 +2732,22 @@ pub const IDLE_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 64u32;
 pub struct IN6_ADDR {
     pub u: IN6_ADDR_0,
 }
+impl Default for IN6_ADDR {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub union IN6_ADDR_0 {
     pub Byte: [u8; 16],
     pub Word: [u16; 8],
 }
+impl Default for IN6_ADDR_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const INFINITE: u32 = 4294967295u32;
 pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32;
 pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32;
@@ -2653,6 +2756,11 @@ pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32;
 pub union INIT_ONCE {
     pub Ptr: *mut core::ffi::c_void,
 }
+impl Default for INIT_ONCE {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const INIT_ONCE_INIT_FAILED: u32 = 4u32;
 pub const INVALID_FILE_ATTRIBUTES: u32 = 4294967295u32;
 pub const INVALID_SOCKET: SOCKET = -1i32 as _;
@@ -2661,6 +2769,11 @@ pub const INVALID_SOCKET: SOCKET = -1i32 as _;
 pub struct IN_ADDR {
     pub S_un: IN_ADDR_0,
 }
+impl Default for IN_ADDR {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub union IN_ADDR_0 {
@@ -2668,8 +2781,13 @@ pub union IN_ADDR_0 {
     pub S_un_w: IN_ADDR_0_1,
     pub S_addr: u32,
 }
+impl Default for IN_ADDR_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct IN_ADDR_0_0 {
     pub s_b1: u8,
     pub s_b2: u8,
@@ -2677,7 +2795,7 @@ pub struct IN_ADDR_0_0 {
     pub s_b4: u8,
 }
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct IN_ADDR_0_1 {
     pub s_w1: u16,
     pub s_w2: u16,
@@ -2690,12 +2808,22 @@ pub struct IO_STATUS_BLOCK {
     pub Anonymous: IO_STATUS_BLOCK_0,
     pub Information: usize,
 }
+impl Default for IO_STATUS_BLOCK {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub union IO_STATUS_BLOCK_0 {
     pub Status: NTSTATUS,
     pub Pointer: *mut core::ffi::c_void,
 }
+impl Default for IO_STATUS_BLOCK_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type IPPROTO = i32;
 pub const IPPROTO_AH: IPPROTO = 51i32;
 pub const IPPROTO_CBT: IPPROTO = 7i32;
@@ -2742,6 +2870,11 @@ pub struct IPV6_MREQ {
     pub ipv6mr_multiaddr: IN6_ADDR,
     pub ipv6mr_interface: u32,
 }
+impl Default for IPV6_MREQ {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const IPV6_MULTICAST_LOOP: i32 = 11i32;
 pub const IPV6_V6ONLY: i32 = 27i32;
 pub const IP_ADD_MEMBERSHIP: i32 = 12i32;
@@ -2752,11 +2885,16 @@ pub struct IP_MREQ {
     pub imr_multiaddr: IN_ADDR,
     pub imr_interface: IN_ADDR,
 }
+impl Default for IP_MREQ {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const IP_MULTICAST_LOOP: i32 = 11i32;
 pub const IP_MULTICAST_TTL: i32 = 10i32;
 pub const IP_TTL: i32 = 4i32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct LINGER {
     pub l_onoff: u16,
     pub l_linger: u16,
@@ -2797,7 +2935,7 @@ pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = Option<
     ),
 >;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct M128A {
     pub Low: u64,
     pub High: i64,
@@ -2838,6 +2976,11 @@ pub struct OBJECT_ATTRIBUTES {
     pub SecurityDescriptor: *const SECURITY_DESCRIPTOR,
     pub SecurityQualityOfService: *const SECURITY_QUALITY_OF_SERVICE,
 }
+impl Default for OBJECT_ATTRIBUTES {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type OBJECT_ATTRIBUTE_FLAGS = u32;
 pub const OBJ_DONT_REPARSE: OBJECT_ATTRIBUTE_FLAGS = 4096u32;
 pub const OPEN_ALWAYS: FILE_CREATION_DISPOSITION = 4u32;
@@ -2850,14 +2993,24 @@ pub struct OVERLAPPED {
     pub Anonymous: OVERLAPPED_0,
     pub hEvent: HANDLE,
 }
+impl Default for OVERLAPPED {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub union OVERLAPPED_0 {
     pub Anonymous: OVERLAPPED_0_0,
     pub Pointer: *mut core::ffi::c_void,
 }
+impl Default for OVERLAPPED_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct OVERLAPPED_0_0 {
     pub Offset: u32,
     pub OffsetHigh: u32,
@@ -2895,6 +3048,11 @@ pub struct PROCESS_INFORMATION {
     pub dwProcessId: u32,
     pub dwThreadId: u32,
 }
+impl Default for PROCESS_INFORMATION {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const PROCESS_MODE_BACKGROUND_BEGIN: PROCESS_CREATION_FLAGS = 1048576u32;
 pub const PROCESS_MODE_BACKGROUND_END: PROCESS_CREATION_FLAGS = 2097152u32;
 pub const PROFILE_KERNEL: PROCESS_CREATION_FLAGS = 536870912u32;
@@ -2926,6 +3084,11 @@ pub struct SECURITY_ATTRIBUTES {
     pub lpSecurityDescriptor: *mut core::ffi::c_void,
     pub bInheritHandle: BOOL,
 }
+impl Default for SECURITY_ATTRIBUTES {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const SECURITY_CONTEXT_TRACKING: FILE_FLAGS_AND_ATTRIBUTES = 262144u32;
 pub const SECURITY_DELEGATION: FILE_FLAGS_AND_ATTRIBUTES = 196608u32;
 #[repr(C)]
@@ -2939,13 +3102,18 @@ pub struct SECURITY_DESCRIPTOR {
     pub Sacl: *mut ACL,
     pub Dacl: *mut ACL,
 }
+impl Default for SECURITY_DESCRIPTOR {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type SECURITY_DESCRIPTOR_CONTROL = u16;
 pub const SECURITY_EFFECTIVE_ONLY: FILE_FLAGS_AND_ATTRIBUTES = 524288u32;
 pub const SECURITY_IDENTIFICATION: FILE_FLAGS_AND_ATTRIBUTES = 65536u32;
 pub const SECURITY_IMPERSONATION: FILE_FLAGS_AND_ATTRIBUTES = 131072u32;
 pub type SECURITY_IMPERSONATION_LEVEL = i32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct SECURITY_QUALITY_OF_SERVICE {
     pub Length: u32,
     pub ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL,
@@ -2962,6 +3130,11 @@ pub struct SOCKADDR {
     pub sa_family: ADDRESS_FAMILY,
     pub sa_data: [i8; 14],
 }
+impl Default for SOCKADDR {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub struct SOCKADDR_STORAGE {
@@ -2970,12 +3143,22 @@ pub struct SOCKADDR_STORAGE {
     pub __ss_align: i64,
     pub __ss_pad2: [i8; 112],
 }
+impl Default for SOCKADDR_STORAGE {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub struct SOCKADDR_UN {
     pub sun_family: ADDRESS_FAMILY,
     pub sun_path: [i8; 108],
 }
+impl Default for SOCKADDR_UN {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type SOCKET = usize;
 pub const SOCKET_ERROR: i32 = -1i32;
 pub const SOCK_DGRAM: WINSOCK_SOCKET_TYPE = 2i32;
@@ -2995,6 +3178,11 @@ pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32;
 pub struct SRWLOCK {
     pub Ptr: *mut core::ffi::c_void,
 }
+impl Default for SRWLOCK {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const STACK_SIZE_PARAM_IS_A_RESERVATION: THREAD_CREATION_FLAGS = 65536u32;
 pub const STANDARD_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 2031616u32;
 pub const STANDARD_RIGHTS_EXECUTE: FILE_ACCESS_RIGHTS = 131072u32;
@@ -3021,6 +3209,11 @@ pub struct STARTUPINFOEXW {
     pub StartupInfo: STARTUPINFOW,
     pub lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST,
 }
+impl Default for STARTUPINFOEXW {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub struct STARTUPINFOW {
@@ -3043,6 +3236,11 @@ pub struct STARTUPINFOW {
     pub hStdOutput: HANDLE,
     pub hStdError: HANDLE,
 }
+impl Default for STARTUPINFOW {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type STARTUPINFOW_FLAGS = u32;
 pub const STATUS_DELETE_PENDING: NTSTATUS = 0xC0000056_u32 as _;
 pub const STATUS_DIRECTORY_NOT_EMPTY: NTSTATUS = 0xC0000101_u32 as _;
@@ -3078,14 +3276,24 @@ pub struct SYSTEM_INFO {
     pub wProcessorLevel: u16,
     pub wProcessorRevision: u16,
 }
+impl Default for SYSTEM_INFO {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub union SYSTEM_INFO_0 {
     pub dwOemId: u32,
     pub Anonymous: SYSTEM_INFO_0_0,
 }
+impl Default for SYSTEM_INFO_0 {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct SYSTEM_INFO_0_0 {
     pub wProcessorArchitecture: PROCESSOR_ARCHITECTURE,
     pub wReserved: u16,
@@ -3097,7 +3305,7 @@ pub type THREAD_CREATION_FLAGS = u32;
 pub const TIMER_ALL_ACCESS: SYNCHRONIZATION_ACCESS_RIGHTS = 2031619u32;
 pub const TIMER_MODIFY_STATE: SYNCHRONIZATION_ACCESS_RIGHTS = 2u32;
 #[repr(C)]
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Default)]
 pub struct TIMEVAL {
     pub tv_sec: i32,
     pub tv_usec: i32,
@@ -3134,6 +3342,11 @@ pub struct UNICODE_STRING {
     pub MaximumLength: u16,
     pub Buffer: PWSTR,
 }
+impl Default for UNICODE_STRING {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const VOLUME_NAME_DOS: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32;
 pub const VOLUME_NAME_GUID: GETFINALPATHNAMEBYHANDLE_FLAGS = 1u32;
 pub const VOLUME_NAME_NONE: GETFINALPATHNAMEBYHANDLE_FLAGS = 4u32;
@@ -3160,6 +3373,11 @@ pub struct WIN32_FIND_DATAW {
     pub cFileName: [u16; 260],
     pub cAlternateFileName: [u16; 14],
 }
+impl Default for WIN32_FIND_DATAW {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub type WINSOCK_SHUTDOWN_HOW = i32;
 pub type WINSOCK_SOCKET_TYPE = i32;
 pub const WRITE_DAC: FILE_ACCESS_RIGHTS = 262144u32;
@@ -3171,6 +3389,11 @@ pub struct WSABUF {
     pub len: u32,
     pub buf: PSTR,
 }
+impl Default for WSABUF {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(target_arch = "x86")]
 #[derive(Clone, Copy)]
@@ -3183,6 +3406,12 @@ pub struct WSADATA {
     pub iMaxUdpDg: u16,
     pub lpVendorInfo: PSTR,
 }
+#[cfg(target_arch = "x86")]
+impl Default for WSADATA {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
 #[derive(Clone, Copy)]
@@ -3195,6 +3424,12 @@ pub struct WSADATA {
     pub szDescription: [i8; 257],
     pub szSystemStatus: [i8; 129],
 }
+#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
+impl Default for WSADATA {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const WSAEACCES: WSA_ERROR = 10013i32;
 pub const WSAEADDRINUSE: WSA_ERROR = 10048i32;
 pub const WSAEADDRNOTAVAIL: WSA_ERROR = 10049i32;
@@ -3255,6 +3490,11 @@ pub struct WSAPROTOCOLCHAIN {
     pub ChainLen: i32,
     pub ChainEntries: [u32; 7],
 }
+impl Default for WSAPROTOCOLCHAIN {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub struct WSAPROTOCOL_INFOW {
@@ -3279,6 +3519,11 @@ pub struct WSAPROTOCOL_INFOW {
     pub dwProviderReserved: u32,
     pub szProtocol: [u16; 256],
 }
+impl Default for WSAPROTOCOL_INFOW {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 pub const WSASERVICE_NOT_FOUND: WSA_ERROR = 10108i32;
 pub const WSASYSCALLFAILURE: WSA_ERROR = 10107i32;
 pub const WSASYSNOTREADY: WSA_ERROR = 10091i32;
@@ -3348,6 +3593,12 @@ pub struct XSAVE_FORMAT {
     pub XmmRegisters: [M128A; 8],
     pub Reserved4: [u8; 224],
 }
+#[cfg(target_arch = "x86")]
+impl Default for XSAVE_FORMAT {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 #[repr(C)]
 #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
 #[derive(Clone, Copy)]
@@ -3369,6 +3620,12 @@ pub struct XSAVE_FORMAT {
     pub XmmRegisters: [M128A; 16],
     pub Reserved4: [u8; 96],
 }
+#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
+impl Default for XSAVE_FORMAT {
+    fn default() -> Self {
+        unsafe { core::mem::zeroed() }
+    }
+}
 
 #[cfg(target_arch = "arm")]
 #[repr(C)]
diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs
index bdf0cc2c59c..3c0a5c2de26 100644
--- a/library/std/src/sys/pal/windows/mod.rs
+++ b/library/std/src/sys/pal/windows/mod.rs
@@ -14,7 +14,6 @@ pub mod compat;
 
 pub mod api;
 
-pub mod args;
 pub mod c;
 pub mod env;
 #[cfg(not(target_vendor = "win7"))]
diff --git a/library/std/src/sys/pal/xous/args.rs b/library/std/src/sys/pal/xous/args.rs
deleted file mode 100644
index 00c44ca220a..00000000000
--- a/library/std/src/sys/pal/xous/args.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-use crate::ffi::OsString;
-use crate::sys::pal::xous::os::get_application_parameters;
-use crate::sys::pal::xous::os::params::ArgumentList;
-use crate::{fmt, vec};
-
-pub struct Args {
-    parsed_args_list: vec::IntoIter<OsString>,
-}
-
-pub fn args() -> Args {
-    let Some(params) = get_application_parameters() else {
-        return Args { parsed_args_list: vec![].into_iter() };
-    };
-
-    for param in params {
-        if let Ok(args) = ArgumentList::try_from(&param) {
-            let mut parsed_args = vec![];
-            for arg in args {
-                parsed_args.push(arg.into());
-            }
-            return Args { parsed_args_list: parsed_args.into_iter() };
-        }
-    }
-    Args { parsed_args_list: vec![].into_iter() }
-}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.parsed_args_list.as_slice().fmt(f)
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        self.parsed_args_list.next()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.parsed_args_list.size_hint()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.parsed_args_list.next_back()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.parsed_args_list.len()
-    }
-}
diff --git a/library/std/src/sys/pal/xous/mod.rs b/library/std/src/sys/pal/xous/mod.rs
index 58926e2beb1..4f652d3f130 100644
--- a/library/std/src/sys/pal/xous/mod.rs
+++ b/library/std/src/sys/pal/xous/mod.rs
@@ -1,6 +1,5 @@
 #![forbid(unsafe_op_in_unsafe_fn)]
 
-pub mod args;
 #[path = "../unsupported/env.rs"]
 pub mod env;
 pub mod os;
diff --git a/library/std/src/sys/pal/zkvm/args.rs b/library/std/src/sys/pal/zkvm/args.rs
deleted file mode 100644
index 47857f6c448..00000000000
--- a/library/std/src/sys/pal/zkvm/args.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-use super::{WORD_SIZE, abi};
-use crate::ffi::OsString;
-use crate::fmt;
-use crate::sys::os_str;
-use crate::sys_common::FromInner;
-
-pub struct Args {
-    i_forward: usize,
-    i_back: usize,
-    count: usize,
-}
-
-pub fn args() -> Args {
-    let count = unsafe { abi::sys_argc() };
-    Args { i_forward: 0, i_back: 0, count }
-}
-
-impl Args {
-    /// Use sys_argv to get the arg at the requested index. Does not check that i is less than argc
-    /// and will not return if the index is out of bounds.
-    fn argv(i: usize) -> OsString {
-        let arg_len = unsafe { abi::sys_argv(crate::ptr::null_mut(), 0, i) };
-
-        let arg_len_words = (arg_len + WORD_SIZE - 1) / WORD_SIZE;
-        let words = unsafe { abi::sys_alloc_words(arg_len_words) };
-
-        let arg_len2 = unsafe { abi::sys_argv(words, arg_len_words, i) };
-        debug_assert_eq!(arg_len, arg_len2);
-
-        // Convert to OsString.
-        //
-        // FIXME: We can probably get rid of the extra copy here if we
-        // reimplement "os_str" instead of just using the generic unix
-        // "os_str".
-        let arg_bytes: &[u8] =
-            unsafe { crate::slice::from_raw_parts(words.cast() as *const u8, arg_len) };
-        OsString::from_inner(os_str::Buf { inner: arg_bytes.to_vec() })
-    }
-}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.debug_list().finish()
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-
-    fn next(&mut self) -> Option<OsString> {
-        if self.i_forward >= self.count - self.i_back {
-            None
-        } else {
-            let arg = Self::argv(self.i_forward);
-            self.i_forward += 1;
-            Some(arg)
-        }
-    }
-
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        (self.count, Some(self.count))
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.count
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        if self.i_back >= self.count - self.i_forward {
-            None
-        } else {
-            let arg = Self::argv(self.count - 1 - self.i_back);
-            self.i_back += 1;
-            Some(arg)
-        }
-    }
-}
diff --git a/library/std/src/sys/pal/zkvm/mod.rs b/library/std/src/sys/pal/zkvm/mod.rs
index 4659dad16e8..ebd7b036779 100644
--- a/library/std/src/sys/pal/zkvm/mod.rs
+++ b/library/std/src/sys/pal/zkvm/mod.rs
@@ -8,11 +8,9 @@
 //! will likely change over time.
 #![forbid(unsafe_op_in_unsafe_fn)]
 
-const WORD_SIZE: usize = size_of::<u32>();
+pub const WORD_SIZE: usize = size_of::<u32>();
 
 pub mod abi;
-#[path = "../zkvm/args.rs"]
-pub mod args;
 pub mod env;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]