@@ -7,6 +7,14 @@ use crate::process;
7
7
use crate :: sys;
8
8
use crate :: sys_common:: { AsInner , AsInnerMut , FromInner , IntoInner } ;
9
9
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
+
10
18
#[ stable( feature = "process_extensions" , since = "1.2.0" ) ]
11
19
impl FromRawHandle for process:: Stdio {
12
20
unsafe fn from_raw_handle ( handle : RawHandle ) -> process:: Stdio {
@@ -73,8 +81,11 @@ impl IntoRawHandle for process::ChildStderr {
73
81
}
74
82
75
83
/// 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.
76
87
#[ stable( feature = "exit_status_from" , since = "1.12.0" ) ]
77
- pub trait ExitStatusExt {
88
+ pub trait ExitStatusExt : private :: Sealed {
78
89
/// Creates a new `ExitStatus` from the raw underlying `u32` return value of
79
90
/// a process.
80
91
#[ stable( feature = "exit_status_from" , since = "1.12.0" ) ]
@@ -88,6 +99,9 @@ impl ExitStatusExt for process::ExitStatus {
88
99
}
89
100
}
90
101
102
+ #[ stable( feature = "none" , since = "1.51.0" ) ]
103
+ impl private:: Sealed for process:: ExitStatus { }
104
+
91
105
/// Windows-specific extensions to the [`process::Command`] builder.
92
106
#[ stable( feature = "windows_process_extensions" , since = "1.16.0" ) ]
93
107
pub trait CommandExt {
0 commit comments