ExitStatusExt unix: Retrospectively seal this trait
As discussed in #79982. I think the "new interfaces", ie the new trait and impl, must be insta-stable. This seems OK because we are, in fact, adding a new restriction to the stable API. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
parent
fa68567a1f
commit
70121941ff
@ -9,6 +9,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 {}
|
||||
}
|
||||
|
||||
/// Unix-specific extensions to the [`process::Command`] builder.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait CommandExt {
|
||||
@ -163,8 +171,11 @@ impl CommandExt for process::Command {
|
||||
}
|
||||
|
||||
/// Unix-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 = "rust1", since = "1.0.0")]
|
||||
pub trait ExitStatusExt {
|
||||
pub trait ExitStatusExt: private::Sealed {
|
||||
/// Creates a new `ExitStatus` from the raw underlying `i32` return value of
|
||||
/// a process.
|
||||
#[stable(feature = "exit_status_from", since = "1.12.0")]
|
||||
@ -199,6 +210,9 @@ pub trait ExitStatusExt {
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user