提交 f3e7199a 编写于 作者: I Ian Jackson

ExitStatusExt windows: Retrospectively seal this trait

Signed-off-by: NIan Jackson <ijackson@chiark.greenend.org.uk>
上级 70121941
......@@ -7,6 +7,14 @@
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 @@ fn into_raw_handle(self) -> RawHandle {
}
/// 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 @@ fn from_raw(raw: u32) -> Self {
}
}
#[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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册