about summary refs log tree commit diff
path: root/library/std/src/sys_common
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2021-02-10 21:30:30 +0000
committerAmanieu d'Antras <amanieu@gmail.com>2021-02-10 21:30:30 +0000
commitbfd1ccfb271f03aa85488408c3b03a15ad8d7c7f (patch)
treecf4ca3826bac096cfbab12f66881c9594dc4e5ab /library/std/src/sys_common
parent07194ffcd25b0871ce560b9f702e52db27ac9f77 (diff)
downloadrust-bfd1ccfb271f03aa85488408c3b03a15ad8d7c7f.tar.gz
rust-bfd1ccfb271f03aa85488408c3b03a15ad8d7c7f.zip
Seal the CommandExt, OsStrExt and OsStringExt traits
Diffstat (limited to 'library/std/src/sys_common')
-rw-r--r--library/std/src/sys_common/os_str_bytes.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/library/std/src/sys_common/os_str_bytes.rs b/library/std/src/sys_common/os_str_bytes.rs
index 497e5fc7bdd..302c5197407 100644
--- a/library/std/src/sys_common/os_str_bytes.rs
+++ b/library/std/src/sys_common/os_str_bytes.rs
@@ -6,6 +6,7 @@ use crate::ffi::{OsStr, OsString};
 use crate::fmt;
 use crate::mem;
 use crate::rc::Rc;
+use crate::sealed::Sealed;
 use crate::str;
 use crate::sync::Arc;
 use crate::sys_common::bytestring::debug_fmt_bytestring;
@@ -232,8 +233,11 @@ impl Slice {
 }
 
 /// Platform-specific extensions to [`OsString`].
+///
+/// This trait is sealed: 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 OsStringExt {
+pub trait OsStringExt: Sealed {
     /// Creates an [`OsString`] from a byte vector.
     ///
     /// See the module documentation for an example.
@@ -258,8 +262,11 @@ impl OsStringExt for OsString {
 }
 
 /// Platform-specific extensions to [`OsStr`].
+///
+/// This trait is sealed: 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 OsStrExt {
+pub trait OsStrExt: Sealed {
     #[stable(feature = "rust1", since = "1.0.0")]
     /// Creates an [`OsStr`] from a byte slice.
     ///