diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2021-02-10 21:30:30 +0000 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2021-02-10 21:30:30 +0000 |
| commit | bfd1ccfb271f03aa85488408c3b03a15ad8d7c7f (patch) | |
| tree | cf4ca3826bac096cfbab12f66881c9594dc4e5ab /library/std/src/sys/unix/ext/process.rs | |
| parent | 07194ffcd25b0871ce560b9f702e52db27ac9f77 (diff) | |
| download | rust-bfd1ccfb271f03aa85488408c3b03a15ad8d7c7f.tar.gz rust-bfd1ccfb271f03aa85488408c3b03a15ad8d7c7f.zip | |
Seal the CommandExt, OsStrExt and OsStringExt traits
Diffstat (limited to 'library/std/src/sys/unix/ext/process.rs')
| -rw-r--r-- | library/std/src/sys/unix/ext/process.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/library/std/src/sys/unix/ext/process.rs b/library/std/src/sys/unix/ext/process.rs index 724b5dcca6a..7559c1f1d9e 100644 --- a/library/std/src/sys/unix/ext/process.rs +++ b/library/std/src/sys/unix/ext/process.rs @@ -6,20 +6,16 @@ use crate::ffi::OsStr; use crate::io; use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use crate::process; +use crate::sealed::Sealed; use crate::sys; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; -mod private { - /// This trait being unreachable from outside the crate - /// prevents other implementations of the `ExitStatusExt` trait, - /// which allows potentially adding more trait methods in the future. - #[stable(feature = "none", since = "1.51.0")] - pub trait Sealed {} -} - /// Unix-specific extensions to the [`process::Command`] builder. +/// +/// This trait is sealed: it cannot be implemented outside the standard library. +/// This is so that future additional methods are not breaking changes. #[stable(feature = "rust1", since = "1.0.0")] -pub trait CommandExt { +pub trait CommandExt: Sealed { /// Sets the child process's user ID. This translates to a /// `setuid` call in the child process. Failure in the `setuid` /// call will cause the spawn to fail. @@ -193,7 +189,7 @@ impl CommandExt for process::Command { /// This trait is sealed: it cannot be implemented outside the standard library. /// This is so that future additional methods are not breaking changes. #[stable(feature = "rust1", since = "1.0.0")] -pub trait ExitStatusExt: private::Sealed { +pub trait ExitStatusExt: Sealed { /// Creates a new `ExitStatus` from the raw underlying `i32` return value of /// a process. #[stable(feature = "exit_status_from", since = "1.12.0")] @@ -228,9 +224,6 @@ pub trait ExitStatusExt: private::Sealed { fn into_raw(self) -> i32; } -#[stable(feature = "none", since = "1.51.0")] -impl private::Sealed for process::ExitStatus {} - #[stable(feature = "rust1", since = "1.0.0")] impl ExitStatusExt for process::ExitStatus { fn from_raw(raw: i32) -> Self { |
