ExitStatusExt windows: Retrospectively seal this trait

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2021-01-04 17:45:23 +00:00
parent 70121941ff
commit f3e7199a79

View File

@ -7,6 +7,14 @@ use crate::process;
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 {}
}
#[stable(feature = "process_extensions", since = "1.2.0")]
impl FromRawHandle for process::Stdio {
unsafe fn from_raw_handle(handle: RawHandle) -> process::Stdio {
@ -73,8 +81,11 @@ impl IntoRawHandle for process::ChildStderr {
}
/// Windows-specific extensions to [`process::ExitStatus`].
///
/// This trait is saeled (since Rust 1.51): it cannot be implemented outside the standard library.
/// This is so that future additional methods are not breaking changes.
#[stable(feature = "exit_status_from", since = "1.12.0")]
pub trait ExitStatusExt {
pub trait ExitStatusExt: private::Sealed {
/// Creates a new `ExitStatus` from the raw underlying `u32` return value of
/// a process.
#[stable(feature = "exit_status_from", since = "1.12.0")]
@ -88,6 +99,9 @@ impl ExitStatusExt for process::ExitStatus {
}
}
#[stable(feature = "none", since = "1.51.0")]
impl private::Sealed for process::ExitStatus {}
/// Windows-specific extensions to the [`process::Command`] builder.
#[stable(feature = "windows_process_extensions", since = "1.16.0")]
pub trait CommandExt {