File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ pub struct OsString {
76
76
inner : Buf ,
77
77
}
78
78
79
+ /// Allows extension traits within `std`.
80
+ #[ unstable( feature = "sealed" , issue = "none" ) ]
81
+ impl crate :: sealed:: Sealed for OsString { }
82
+
79
83
/// Borrowed reference to an OS string (see [`OsString`]).
80
84
///
81
85
/// This type represents a borrowed reference to a string in the operating system's preferred
@@ -100,6 +104,10 @@ pub struct OsStr {
100
104
inner : Slice ,
101
105
}
102
106
107
+ /// Allows extension traits within `std`.
108
+ #[ unstable( feature = "sealed" , issue = "none" ) ]
109
+ impl crate :: sealed:: Sealed for OsStr { }
110
+
103
111
impl OsString {
104
112
/// Constructs a new empty `OsString`.
105
113
///
Original file line number Diff line number Diff line change 53
53
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
54
54
55
55
use crate :: ffi:: { OsStr , OsString } ;
56
+ use crate :: sealed:: Sealed ;
56
57
use crate :: sys:: os_str:: Buf ;
57
58
use crate :: sys_common:: wtf8:: Wtf8Buf ;
58
59
use crate :: sys_common:: { AsInner , FromInner } ;
@@ -62,7 +63,7 @@ pub use crate::sys_common::wtf8::EncodeWide;
62
63
63
64
/// Windows-specific extensions to [`OsString`].
64
65
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
65
- pub trait OsStringExt {
66
+ pub trait OsStringExt : Sealed {
66
67
/// Creates an `OsString` from a potentially ill-formed UTF-16 slice of
67
68
/// 16-bit code units.
68
69
///
@@ -93,7 +94,7 @@ impl OsStringExt for OsString {
93
94
94
95
/// Windows-specific extensions to [`OsStr`].
95
96
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
96
- pub trait OsStrExt {
97
+ pub trait OsStrExt : Sealed {
97
98
/// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially
98
99
/// ill-formed UTF-16.
99
100
///
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use crate::ffi::{OsStr, OsString};
6
6
use crate :: fmt;
7
7
use crate :: mem;
8
8
use crate :: rc:: Rc ;
9
+ use crate :: sealed:: Sealed ;
9
10
use crate :: str;
10
11
use crate :: sync:: Arc ;
11
12
use crate :: sys_common:: bytestring:: debug_fmt_bytestring;
@@ -233,7 +234,7 @@ impl Slice {
233
234
234
235
/// Platform-specific extensions to [`OsString`].
235
236
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
236
- pub trait OsStringExt {
237
+ pub trait OsStringExt : Sealed {
237
238
/// Creates an [`OsString`] from a byte vector.
238
239
///
239
240
/// See the module documentation for an example.
@@ -259,7 +260,7 @@ impl OsStringExt for OsString {
259
260
260
261
/// Platform-specific extensions to [`OsStr`].
261
262
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
262
- pub trait OsStrExt {
263
+ pub trait OsStrExt : Sealed {
263
264
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
264
265
/// Creates an [`OsStr`] from a byte slice.
265
266
///
You can’t perform that action at this time.
0 commit comments