Auto merge of #149930 - joboet:small-sys-refactor, r=ChrisDenton
std: small `sys` refactor Part of rust-lang/rust#117276 The large number of files changed just results from the need to update a lot of imports. Actually this PR only: * combines the two definitions of `RawOsError` in `sys::pal` into one in `sys::io` * moves `FULL_BACKTRACE_DEFAULT` from `sys::pal` to `sys::backtrace` * moves the `FromInner`/`IntoInner`/... traits into `sys` (in preparation for removing `sys_common` entirely)
This commit is contained in:
commit
21ff67df15
102 changed files with 132 additions and 170 deletions
|
|
@ -13,7 +13,7 @@ use crate::rc::Rc;
|
|||
use crate::str::FromStr;
|
||||
use crate::sync::Arc;
|
||||
use crate::sys::os_str::{Buf, Slice};
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{cmp, fmt, slice};
|
||||
|
||||
/// A type that can represent owned, mutable platform-native strings, but is
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read, Seek, SeekFrom,
|
|||
use crate::path::{Path, PathBuf};
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sync::Arc;
|
||||
use crate::sys::fs as fs_imp;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner, fs as fs_imp};
|
||||
use crate::time::SystemTime;
|
||||
use crate::{error, fmt};
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ enum ErrorData<C> {
|
|||
///
|
||||
/// [`into`]: Into::into
|
||||
#[unstable(feature = "raw_os_error_ty", issue = "107792")]
|
||||
pub type RawOsError = sys::RawOsError;
|
||||
pub type RawOsError = sys::io::RawOsError;
|
||||
|
||||
// `#[repr(align(4))]` is probably redundant, it should have that value or
|
||||
// higher already. We include it just because repr_bitpacked.rs's encoding
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use crate::io;
|
||||
use crate::sys::pipe as imp;
|
||||
use crate::sys_common::{FromInner, IntoInner};
|
||||
use crate::sys::{FromInner, IntoInner, pipe as imp};
|
||||
|
||||
/// Creates an anonymous pipe.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ use crate::io::prelude::*;
|
|||
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
|
||||
use crate::iter::FusedIterator;
|
||||
use crate::net::{Shutdown, SocketAddr, ToSocketAddrs};
|
||||
use crate::sys::net as net_imp;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, net as net_imp};
|
||||
use crate::time::Duration;
|
||||
|
||||
/// A TCP stream between a local and a remote socket.
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ mod tests;
|
|||
use crate::fmt;
|
||||
use crate::io::{self, ErrorKind};
|
||||
use crate::net::{Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs};
|
||||
use crate::sys::net as net_imp;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, net as net_imp};
|
||||
use crate::time::Duration;
|
||||
|
||||
/// A UDP socket.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::android::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
/// [`fs::Metadata`]: crate::fs::Metadata
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
use crate::fs::{self, Metadata};
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, IntoInner};
|
||||
use crate::time::SystemTime;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::dragonfly::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::emscripten::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::espidf::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::os::fd::owned::OwnedFd;
|
||||
use crate::os::fd::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{net, sys};
|
||||
|
||||
macro_rules! impl_as_raw_fd {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use crate::mem::ManuallyDrop;
|
|||
)))]
|
||||
use crate::sys::cvt;
|
||||
#[cfg(not(target_os = "trusty"))]
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{fmt, io};
|
||||
|
||||
type ValidRawFd = core::num::niche_types::NotAllOnes<RawFd>;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use crate::os::unix::io::OwnedFd;
|
|||
#[cfg(target_os = "wasi")]
|
||||
use crate::os::wasi::io::OwnedFd;
|
||||
#[cfg(not(target_os = "trusty"))]
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
|
||||
/// Raw file descriptors.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::freebsd::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use crate::ffi::CStr;
|
|||
use crate::io;
|
||||
use crate::os::unix::net;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// FreeBSD-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
|
||||
/// and [`UnixStream`].
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::haiku::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::net;
|
||||
use crate::os::hermit::io::{AsRawFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::sys_common::{self, AsInner, FromInner, IntoInner};
|
||||
use crate::{net, sys};
|
||||
use crate::sys::{self, AsInner, FromInner, IntoInner};
|
||||
|
||||
macro_rules! impl_as_raw_fd {
|
||||
($($t:ident)*) => {$(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::illumos::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
use crate::io;
|
||||
use crate::os::unix::net;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// illumos-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
|
||||
/// and [`UnixStream`].
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::l4re::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::linux::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ use crate::io::Result;
|
|||
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::process::{self, ExitStatus};
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
#[cfg(not(doc))]
|
||||
use crate::sys::{fd::FileDesc, linux::pidfd::PidFd as InnerPidFd};
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
|
||||
#[cfg(doc)]
|
||||
struct InnerPidFd;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::{AsInner, IntoInner};
|
||||
use crate::sys::{AsInner, IntoInner};
|
||||
|
||||
/// Motor OS–specific extensions to [`OsString`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![unstable(feature = "motor_ext", issue = "147456")]
|
||||
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
pub trait ChildExt: Sealed {
|
||||
/// Extracts the main thread raw handle, without taking ownership
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::io;
|
||||
use crate::os::unix::net;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// Linux-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
|
||||
/// and [`UnixStream`].
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//! [`std::net`]: crate::net
|
||||
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::time::Duration;
|
||||
use crate::{io, net};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::netbsd::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use crate::ffi::CStr;
|
|||
use crate::io;
|
||||
use crate::os::unix::net;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// NetBSD-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
|
||||
/// and [`UnixStream`].
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
pub trait MetadataExt {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
pub trait MetadataExt {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::openbsd::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::redox::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::fs::Metadata;
|
||||
#[allow(deprecated)]
|
||||
use crate::os::solaris::raw;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
use crate::io;
|
||||
use crate::os::unix::net;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// solaris-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
|
||||
/// and [`UnixStream`].
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
use crate::marker::PhantomData;
|
||||
use crate::mem::ManuallyDrop;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{fmt, net, sys};
|
||||
|
||||
/// Raw file descriptors.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::ffi::{OsStr, OsString};
|
|||
use crate::mem;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys::os_str::Buf;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
|
||||
// Note: this file is currently reused in other `std::os::{platform}::ffi` modules to reduce duplication.
|
||||
// Keep this in mind when applying changes to this file that only apply to `unix`.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use crate::io::BorrowedCursor;
|
|||
use crate::os::unix::io::{AsFd, AsRawFd};
|
||||
use crate::path::Path;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner};
|
||||
use crate::{io, sys};
|
||||
|
||||
// Tests for this module
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@ use crate::net::Shutdown;
|
|||
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::path::Path;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::net::Socket;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, cvt};
|
||||
use crate::time::Duration;
|
||||
use crate::{fmt, io};
|
||||
#[cfg(not(any(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use super::{SocketAddr, UnixStream, sockaddr_un};
|
||||
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::path::Path;
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::net::Socket;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, cvt};
|
||||
use crate::{fmt, io, mem};
|
||||
|
||||
/// A structure representing a Unix domain socket server.
|
||||
|
|
|
|||
|
|
@ -36,9 +36,8 @@ use crate::net::Shutdown;
|
|||
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::path::Path;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::net::Socket;
|
||||
use crate::sys_common::{AsInner, FromInner};
|
||||
use crate::sys::{AsInner, FromInner, cvt};
|
||||
use crate::time::Duration;
|
||||
|
||||
/// A Unix stream socket.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, Owned
|
|||
use crate::path::Path;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys::process::ChildPipe;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::{io, process, sys};
|
||||
|
||||
cfg_select! {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#[allow(deprecated)]
|
||||
use crate::os::unix::raw::pthread_t;
|
||||
use crate::sys_common::{AsInner, IntoInner};
|
||||
use crate::sys::{AsInner, IntoInner};
|
||||
use crate::thread::JoinHandle;
|
||||
|
||||
#[stable(feature = "thread_extensions", since = "1.9.0")]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
/// OS-specific extensions to [`fs::Metadata`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
|
||||
use crate::fs::Metadata;
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
|
||||
///
|
||||
/// [`fs::Metadata`]: crate::fs::Metadata
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use crate::os::fd::AsRawFd;
|
|||
use crate::path::Path;
|
||||
#[cfg(target_env = "p1")]
|
||||
use crate::sys::err2io;
|
||||
use crate::sys_common::{AsInner, AsInnerMut};
|
||||
use crate::sys::{AsInner, AsInnerMut};
|
||||
|
||||
/// WASI-specific extensions to [`File`].
|
||||
pub trait FileExt {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ use crate::fmt;
|
|||
use crate::iter::FusedIterator;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys::os_str::Buf;
|
||||
use crate::sys_common::{AsInner, FromInner};
|
||||
use crate::sys::{AsInner, FromInner};
|
||||
|
||||
/// Windows-specific extensions to [`OsString`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use crate::fs::{self, Metadata, OpenOptions};
|
|||
use crate::io::BorrowedCursor;
|
||||
use crate::path::Path;
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, IntoInner};
|
||||
use crate::time::SystemTime;
|
||||
use crate::{io, sys};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
use super::raw::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle};
|
||||
use crate::marker::PhantomData;
|
||||
use crate::mem::ManuallyDrop;
|
||||
use crate::sys::cvt;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, cvt};
|
||||
use crate::{fmt, fs, io, ptr, sys};
|
||||
|
||||
/// A borrowed handle.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
use crate::os::windows::io::{AsHandle, AsSocket};
|
||||
use crate::os::windows::io::{OwnedHandle, OwnedSocket};
|
||||
use crate::os::windows::raw;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{fs, io, net, ptr, sys};
|
||||
|
||||
/// Raw HANDLEs.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use crate::os::windows::io::{
|
|||
AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle,
|
||||
};
|
||||
use crate::sealed::Sealed;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::{io, marker, process, ptr, sys};
|
||||
|
||||
#[stable(feature = "process_extensions", since = "1.2.0")]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![stable(feature = "thread_extensions", since = "1.9.0")]
|
||||
|
||||
use crate::os::windows::io::{AsRawHandle, IntoRawHandle, RawHandle};
|
||||
use crate::sys_common::{AsInner, IntoInner};
|
||||
use crate::sys::{AsInner, IntoInner};
|
||||
use crate::thread;
|
||||
|
||||
#[stable(feature = "thread_extensions", since = "1.9.0")]
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> {
|
|||
Some(x) if &x == "0" => BacktraceStyle::Off,
|
||||
Some(x) if &x == "full" => BacktraceStyle::Full,
|
||||
Some(_) => BacktraceStyle::Short,
|
||||
None if crate::sys::FULL_BACKTRACE_DEFAULT => BacktraceStyle::Full,
|
||||
None if crate::sys::backtrace::FULL_BACKTRACE_DEFAULT => BacktraceStyle::Full,
|
||||
None => BacktraceStyle::Off,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -166,8 +166,7 @@ use crate::io::prelude::*;
|
|||
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
|
||||
use crate::num::NonZero;
|
||||
use crate::path::Path;
|
||||
use crate::sys::process as imp;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner, process as imp};
|
||||
use crate::{fmt, fs, str};
|
||||
|
||||
/// Representation of a running or exited child process.
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ use crate::ffi::OsString;
|
|||
use crate::num::NonZero;
|
||||
use crate::ops::Try;
|
||||
use crate::sync::atomic::{Atomic, AtomicUsize, Ordering};
|
||||
use crate::sys::FromInner;
|
||||
use crate::sys::os_str::Buf;
|
||||
use crate::sys::pal::abi::usercalls::alloc;
|
||||
use crate::sys::pal::abi::usercalls::raw::ByteBuffer;
|
||||
use crate::sys_common::FromInner;
|
||||
use crate::{fmt, slice};
|
||||
|
||||
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ use crate::path::{Path, PathBuf};
|
|||
use crate::sys::pal::os::current_exe;
|
||||
use crate::sys::pal::{ensure_no_nuls, fill_utf16_buf};
|
||||
use crate::sys::path::get_long_path;
|
||||
use crate::sys::{c, to_u16s};
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::{AsInner, c, to_u16s};
|
||||
use crate::sys_common::wstr::WStrUnits;
|
||||
use crate::{io, iter, ptr};
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@ use crate::{env, fmt, io};
|
|||
/// Max number of frames to print.
|
||||
const MAX_NB_FRAMES: usize = 100;
|
||||
|
||||
pub(crate) const FULL_BACKTRACE_DEFAULT: bool = cfg_select! {
|
||||
// Fuchsia components default to full backtrace.
|
||||
target_os = "fuchsia" => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
pub(crate) struct BacktraceLock<'a>(#[allow(dead_code)] MutexGuard<'a, ()>);
|
||||
|
||||
pub(crate) fn lock<'a>() -> BacktraceLock<'a> {
|
||||
|
|
|
|||
3
library/std/src/sys/env/zkvm.rs
vendored
3
library/std/src/sys/env/zkvm.rs
vendored
|
|
@ -4,9 +4,8 @@ mod unsupported_env;
|
|||
pub use unsupported_env::{Env, env, setenv, unsetenv};
|
||||
|
||||
use crate::ffi::{OsStr, OsString};
|
||||
use crate::sys::os_str;
|
||||
use crate::sys::pal::{WORD_SIZE, abi};
|
||||
use crate::sys_common::FromInner;
|
||||
use crate::sys::{FromInner, os_str};
|
||||
|
||||
pub fn getenv(varname: &OsStr) -> Option<OsString> {
|
||||
let varname = varname.as_encoded_bytes();
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ use crate::cmp;
|
|||
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read, SeekFrom};
|
||||
use crate::os::hermit::hermit_abi;
|
||||
use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::sys::{cvt, unsupported};
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, cvt, unsupported};
|
||||
|
||||
const fn max_iov() -> usize {
|
||||
hermit_abi::IOV_MAX
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read};
|
||||
use crate::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::sys::map_motor_error;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, map_motor_error};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FileDesc(OwnedFd);
|
||||
|
|
|
|||
|
|
@ -36,12 +36,11 @@ cfg_select! {
|
|||
use crate::cmp;
|
||||
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read};
|
||||
use crate::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::sys::cvt;
|
||||
#[cfg(all(target_os = "android", target_pointer_width = "64"))]
|
||||
use crate::sys::pal::weak::syscall;
|
||||
#[cfg(any(all(target_os = "android", target_pointer_width = "32"), target_vendor = "apple"))]
|
||||
use crate::sys::pal::weak::weak;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, cvt};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FileDesc(OwnedFd);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ use crate::sys::common::small_c_string::run_path_with_cstr;
|
|||
use crate::sys::fd::FileDesc;
|
||||
pub use crate::sys::fs::common::{copy, exists};
|
||||
use crate::sys::time::SystemTime;
|
||||
use crate::sys::{cvt, unsupported, unsupported_err};
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner, cvt, unsupported, unsupported_err};
|
||||
use crate::{fmt, mem};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ use crate::path::{Path, PathBuf};
|
|||
use crate::sys::fd::FileDesc;
|
||||
pub use crate::sys::fs::common::exists;
|
||||
use crate::sys::time::SystemTime;
|
||||
use crate::sys::{map_motor_error, unsupported};
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner, map_motor_error, unsupported};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct FileType {
|
||||
|
|
|
|||
|
|
@ -97,8 +97,7 @@ use crate::sys::time::SystemTime;
|
|||
use crate::sys::weak::syscall;
|
||||
#[cfg(target_os = "android")]
|
||||
use crate::sys::weak::weak;
|
||||
use crate::sys::{cvt, cvt_r};
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner, cvt, cvt_r};
|
||||
use crate::{mem, ptr};
|
||||
|
||||
pub struct File(FileDesc);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ use crate::sys::pal::api::{self, WinError, set_file_information_by_handle};
|
|||
use crate::sys::pal::{IoResult, fill_utf16_buf, to_u16s, truncate_utf16_at_nul};
|
||||
use crate::sys::path::{WCStr, maybe_verbatim};
|
||||
use crate::sys::time::SystemTime;
|
||||
use crate::sys::{Align8, c, cvt};
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{Align8, AsInner, FromInner, IntoInner, c, cvt};
|
||||
use crate::{fmt, ptr, slice};
|
||||
|
||||
mod remove_dir_all;
|
||||
|
|
|
|||
|
|
@ -55,3 +55,8 @@ pub use kernel_copy::{CopyState, kernel_copy};
|
|||
// Bare metal platforms usually have very small amounts of RAM
|
||||
// (in the order of hundreds of KB)
|
||||
pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf") { 512 } else { 8 * 1024 };
|
||||
|
||||
pub type RawOsError = cfg_select! {
|
||||
target_os = "uefi" => usize,
|
||||
_ => i32,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,3 +37,25 @@ pub mod thread_local;
|
|||
// FIXME(117276): remove this, move feature implementations into individual
|
||||
// submodules.
|
||||
pub use pal::*;
|
||||
|
||||
/// A trait for viewing representations from std types.
|
||||
#[cfg_attr(not(target_os = "linux"), allow(unused))]
|
||||
pub(crate) trait AsInner<Inner: ?Sized> {
|
||||
fn as_inner(&self) -> &Inner;
|
||||
}
|
||||
|
||||
/// A trait for viewing representations from std types.
|
||||
#[cfg_attr(not(target_os = "linux"), allow(unused))]
|
||||
pub(crate) trait AsInnerMut<Inner: ?Sized> {
|
||||
fn as_inner_mut(&mut self) -> &mut Inner;
|
||||
}
|
||||
|
||||
/// A trait for extracting representations from std types.
|
||||
pub(crate) trait IntoInner<Inner> {
|
||||
fn into_inner(self) -> Inner;
|
||||
}
|
||||
|
||||
/// A trait for creating std types from internal representations.
|
||||
pub(crate) trait FromInner<Inner> {
|
||||
fn from_inner(inner: Inner) -> Self;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ use crate::net::SocketAddr::{V4, V6};
|
|||
use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr, ToSocketAddrs};
|
||||
use crate::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::sys::fd::FileDesc;
|
||||
use crate::sys::map_motor_error;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, map_motor_error};
|
||||
use crate::time::Duration;
|
||||
|
||||
// We want to re-use as much of Rust's stdlib code as possible,
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ use crate::net::{Shutdown, SocketAddr};
|
|||
use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, RawFd};
|
||||
use crate::sys::fd::FileDesc;
|
||||
use crate::sys::time::Instant;
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
pub use crate::sys::{cvt, cvt_r};
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::time::Duration;
|
||||
use crate::{cmp, mem};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use crate::net::{
|
|||
};
|
||||
use crate::sys::common::small_c_string::run_with_cstr;
|
||||
use crate::sys::net::connection::each_addr;
|
||||
use crate::sys_common::{AsInner, FromInner};
|
||||
use crate::sys::{AsInner, FromInner};
|
||||
use crate::time::Duration;
|
||||
use crate::{cmp, fmt, mem, ptr};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ use crate::ffi::CStr;
|
|||
use crate::io::{self, BorrowedBuf, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut};
|
||||
use crate::net::{Shutdown, SocketAddr};
|
||||
use crate::os::solid::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd};
|
||||
use crate::sys::abi;
|
||||
use crate::sys_common::{FromInner, IntoInner};
|
||||
use crate::sys::{FromInner, IntoInner, abi};
|
||||
use crate::time::Duration;
|
||||
use crate::{cmp, mem, ptr, str};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use crate::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
|||
use crate::sys::fd::FileDesc;
|
||||
use crate::sys::net::{getsockopt, setsockopt};
|
||||
use crate::sys::pal::IsMinusOne;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::time::{Duration, Instant};
|
||||
use crate::{cmp, mem};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@ use crate::net::{Shutdown, SocketAddr};
|
|||
use crate::os::windows::io::{
|
||||
AsRawSocket, AsSocket, BorrowedSocket, FromRawSocket, IntoRawSocket, OwnedSocket, RawSocket,
|
||||
};
|
||||
use crate::sys::c;
|
||||
use crate::sys::pal::winsock::last_error;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, c};
|
||||
use crate::time::Duration;
|
||||
use crate::{cmp, mem, ptr, sys};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
|
|||
use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr, ToSocketAddrs};
|
||||
use crate::os::wasi::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::sys::fd::FileDesc;
|
||||
use crate::sys::{err2io, unsupported};
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, err2io, unsupported};
|
||||
use crate::time::Duration;
|
||||
|
||||
pub struct Socket(FileDesc);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use crate::collections::TryReserveError;
|
|||
use crate::fmt::Write;
|
||||
use crate::rc::Rc;
|
||||
use crate::sync::Arc;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{fmt, mem, str};
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use crate::borrow::Cow;
|
|||
use crate::collections::TryReserveError;
|
||||
use crate::rc::Rc;
|
||||
use crate::sync::Arc;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{fmt, mem};
|
||||
|
||||
#[derive(Hash)]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use crate::borrow::Cow;
|
|||
use crate::collections::TryReserveError;
|
||||
use crate::rc::Rc;
|
||||
use crate::sync::Arc;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner};
|
||||
use crate::{fmt, mem};
|
||||
|
||||
#[derive(Hash)]
|
||||
|
|
|
|||
|
|
@ -86,12 +86,3 @@ cfg_select! {
|
|||
pub use self::unsupported::*;
|
||||
}
|
||||
}
|
||||
|
||||
pub const FULL_BACKTRACE_DEFAULT: bool = cfg_select! {
|
||||
// Fuchsia components default to full backtrace.
|
||||
target_os = "fuchsia" => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
#[cfg(not(target_os = "uefi"))]
|
||||
pub type RawOsError = i32;
|
||||
|
|
|
|||
|
|
@ -120,8 +120,6 @@ pub extern "C" fn __rust_abort() {
|
|||
abort_internal();
|
||||
}
|
||||
|
||||
pub use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
|
||||
pub trait TryIntoInner<Inner>: Sized {
|
||||
fn try_into_inner(self) -> Result<Inner, Self>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
//! [`OsString`]: crate::ffi::OsString
|
||||
#![forbid(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
use crate::io::RawOsError;
|
||||
|
||||
pub mod helpers;
|
||||
pub mod os;
|
||||
pub mod time;
|
||||
|
|
@ -20,8 +22,6 @@ pub mod time;
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub type RawOsError = usize;
|
||||
|
||||
use crate::io as std_io;
|
||||
use crate::os::uefi;
|
||||
use crate::ptr::NonNull;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use crate::io;
|
||||
use crate::os::fd::{AsRawFd, FromRawFd, RawFd};
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::fd::FileDesc;
|
||||
use crate::sys::process::ExitStatus;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, cvt};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use core::num::niche_types::Nanoseconds;
|
||||
|
||||
use crate::sys_common::AsInner;
|
||||
use crate::sys::AsInner;
|
||||
use crate::time::Duration;
|
||||
use crate::{fmt, io};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, Read};
|
|||
use crate::os::windows::io::{
|
||||
AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle,
|
||||
};
|
||||
use crate::sys::{c, cvt};
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, c, cvt};
|
||||
|
||||
/// An owned container for `HANDLE` object, closing them on Drop.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ use core::ops::Neg;
|
|||
|
||||
use crate::cmp::Ordering;
|
||||
use crate::ptr::null;
|
||||
use crate::sys::c;
|
||||
use crate::sys_common::IntoInner;
|
||||
use crate::sys::{IntoInner, c};
|
||||
use crate::time::Duration;
|
||||
use crate::{fmt, mem};
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ impl fmt::Debug for Pipe {
|
|||
mod unix_traits {
|
||||
use super::Pipe;
|
||||
use crate::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::sys_common::{FromInner, IntoInner};
|
||||
use crate::sys::{FromInner, IntoInner};
|
||||
|
||||
impl AsRawFd for Pipe {
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ use crate::os::motor::ffi::OsStrExt;
|
|||
use crate::path::Path;
|
||||
use crate::process::StdioPipes;
|
||||
use crate::sys::fs::File;
|
||||
use crate::sys::map_motor_error;
|
||||
use crate::sys_common::{AsInner, FromInner};
|
||||
use crate::sys::{AsInner, FromInner, map_motor_error};
|
||||
use crate::{fmt, io};
|
||||
|
||||
pub enum Stdio {
|
||||
|
|
|
|||
|
|
@ -10,14 +10,13 @@ use crate::ffi::{CStr, CString, OsStr, OsString};
|
|||
use crate::os::unix::prelude::*;
|
||||
use crate::path::Path;
|
||||
use crate::process::StdioPipes;
|
||||
use crate::sys::cvt_r;
|
||||
use crate::sys::fd::FileDesc;
|
||||
use crate::sys::fs::File;
|
||||
#[cfg(not(target_os = "fuchsia"))]
|
||||
use crate::sys::fs::OpenOptions;
|
||||
use crate::sys::pipe::pipe;
|
||||
use crate::sys::process::env::{CommandEnv, CommandEnvs};
|
||||
use crate::sys_common::{FromInner, IntoInner};
|
||||
use crate::sys::{FromInner, IntoInner, cvt_r};
|
||||
use crate::{fmt, io, mem};
|
||||
|
||||
mod cstring_array;
|
||||
|
|
|
|||
|
|
@ -966,7 +966,7 @@ impl Process {
|
|||
/// [I/O Safety]: crate::io#io-safety
|
||||
unsafe fn new(pid: pid_t, pidfd: pid_t) -> Self {
|
||||
use crate::os::unix::io::FromRawFd;
|
||||
use crate::sys_common::FromInner;
|
||||
use crate::sys::FromInner;
|
||||
// Safety: If `pidfd` is nonnegative, we assume it's valid and otherwise unowned.
|
||||
let pidfd = (pidfd >= 0).then(|| PidFd::from_inner(sys::fd::FileDesc::from_raw_fd(pidfd)));
|
||||
Process { pid, status: None, pidfd }
|
||||
|
|
@ -1264,8 +1264,8 @@ impl ExitStatusError {
|
|||
mod linux_child_ext {
|
||||
use crate::io::ErrorKind;
|
||||
use crate::os::linux::process as os;
|
||||
use crate::sys::FromInner;
|
||||
use crate::sys::pal::linux::pidfd as imp;
|
||||
use crate::sys_common::FromInner;
|
||||
use crate::{io, mem};
|
||||
|
||||
#[unstable(feature = "linux_pidfd", issue = "82971")]
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ use crate::sys::fs::{File, OpenOptions};
|
|||
use crate::sys::handle::Handle;
|
||||
use crate::sys::pal::api::{self, WinError, utf16};
|
||||
use crate::sys::pal::{ensure_no_nuls, fill_utf16_buf};
|
||||
use crate::sys::{cvt, path, stdio};
|
||||
use crate::sys_common::IntoInner;
|
||||
use crate::sys::{IntoInner, cvt, path, stdio};
|
||||
use crate::{cmp, env, fmt, ptr};
|
||||
|
||||
mod child_pipe;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
|
|||
use crate::ops::Neg;
|
||||
use crate::os::windows::prelude::*;
|
||||
use crate::sys::handle::Handle;
|
||||
use crate::sys::{api, c};
|
||||
use crate::sys_common::{FromInner, IntoInner};
|
||||
use crate::sys::{FromInner, IntoInner, api, c};
|
||||
use crate::{mem, ptr};
|
||||
|
||||
pub struct ChildPipe {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use crate::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||
use crate::sys::map_motor_error;
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::sys::{AsInner, FromInner, IntoInner, map_motor_error};
|
||||
use crate::{io, process, sys};
|
||||
|
||||
pub const STDIN_BUF_SIZE: usize = crate::sys::io::DEFAULT_BUF_SIZE;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ use crate::os::windows::io::{AsRawHandle, HandleOrNull};
|
|||
use crate::sys::handle::Handle;
|
||||
use crate::sys::pal::time::WaitableTimer;
|
||||
use crate::sys::pal::{dur2timeout, to_u16s};
|
||||
use crate::sys::{c, stack_overflow};
|
||||
use crate::sys_common::FromInner;
|
||||
use crate::sys::{FromInner, c, stack_overflow};
|
||||
use crate::thread::ThreadInit;
|
||||
use crate::time::Duration;
|
||||
use crate::{io, ptr};
|
||||
|
|
|
|||
|
|
@ -23,32 +23,6 @@ pub mod wstr;
|
|||
|
||||
// common error constructors
|
||||
|
||||
/// A trait for viewing representations from std types
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)] // not used on all platforms
|
||||
pub trait AsInner<Inner: ?Sized> {
|
||||
fn as_inner(&self) -> &Inner;
|
||||
}
|
||||
|
||||
/// A trait for viewing representations from std types
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)] // not used on all platforms
|
||||
pub trait AsInnerMut<Inner: ?Sized> {
|
||||
fn as_inner_mut(&mut self) -> &mut Inner;
|
||||
}
|
||||
|
||||
/// A trait for extracting representations from std types
|
||||
#[doc(hidden)]
|
||||
pub trait IntoInner<Inner> {
|
||||
fn into_inner(self) -> Inner;
|
||||
}
|
||||
|
||||
/// A trait for creating std types from internal representations
|
||||
#[doc(hidden)]
|
||||
pub trait FromInner<Inner> {
|
||||
fn from_inner(inner: Inner) -> Self;
|
||||
}
|
||||
|
||||
// Computes (value*numerator)/denom without overflow, as long as both (numerator*denom) and the
|
||||
// overall result fit into i64 (which is the case for our time conversions).
|
||||
#[allow(dead_code)] // not used on all platforms
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ use super::Result;
|
|||
use super::lifecycle::JoinInner;
|
||||
use super::thread::Thread;
|
||||
use crate::fmt;
|
||||
use crate::sys::thread as imp;
|
||||
use crate::sys_common::{AsInner, IntoInner};
|
||||
use crate::sys::{AsInner, IntoInner, thread as imp};
|
||||
|
||||
/// An owned permission to join on a thread (block on its termination).
|
||||
///
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue