Skip to content

Commit f3e7199

Browse files
committed
ExitStatusExt windows: Retrospectively seal this trait
Signed-off-by: Ian Jackson <[email protected]>
1 parent 7012194 commit f3e7199

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

library/std/src/sys/windows/ext/process.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ use crate::process;
77
use crate::sys;
88
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
99

10+
mod private {
11+
/// This trait being unreachable from outside the crate
12+
/// prevents other implementations of the `ExitStatusExt` trait,
13+
/// which allows potentially adding more trait methods in the future.
14+
#[stable(feature = "none", since = "1.51.0")]
15+
pub trait Sealed {}
16+
}
17+
1018
#[stable(feature = "process_extensions", since = "1.2.0")]
1119
impl FromRawHandle for process::Stdio {
1220
unsafe fn from_raw_handle(handle: RawHandle) -> process::Stdio {
@@ -73,8 +81,11 @@ impl IntoRawHandle for process::ChildStderr {
7381
}
7482

7583
/// Windows-specific extensions to [`process::ExitStatus`].
84+
///
85+
/// This trait is saeled (since Rust 1.51): it cannot be implemented outside the standard library.
86+
/// This is so that future additional methods are not breaking changes.
7687
#[stable(feature = "exit_status_from", since = "1.12.0")]
77-
pub trait ExitStatusExt {
88+
pub trait ExitStatusExt: private::Sealed {
7889
/// Creates a new `ExitStatus` from the raw underlying `u32` return value of
7990
/// a process.
8091
#[stable(feature = "exit_status_from", since = "1.12.0")]
@@ -88,6 +99,9 @@ impl ExitStatusExt for process::ExitStatus {
8899
}
89100
}
90101

102+
#[stable(feature = "none", since = "1.51.0")]
103+
impl private::Sealed for process::ExitStatus {}
104+
91105
/// Windows-specific extensions to the [`process::Command`] builder.
92106
#[stable(feature = "windows_process_extensions", since = "1.16.0")]
93107
pub trait CommandExt {

0 commit comments

Comments
 (0)