File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -678,8 +678,10 @@ impl OsStr {
678
678
/// `OsStr`'s encoding is an unspecified superset of UTF-8 and callers must
679
679
/// pass in bytes that originated as a mixture of validated UTF-8 and bytes from
680
680
/// [`OsStr::as_os_str_bytes`] from within the same rust version built for the same target
681
- /// platform. The bytes from `OsStr::as_os_str_bytes` may be split either
682
- /// immediately before or immediately after some valid non-empty UTF-8 substring
681
+ /// platform. For example, reconstructing an `OsStr` from bytes sent over the network or stored
682
+ /// in a file will likely violate these safety rules. The bytes from `OsStr::as_os_str_bytes`
683
+ /// may be split either immediately before or immediately after some valid non-empty UTF-8
684
+ /// substring
683
685
///
684
686
/// # Example
685
687
///
@@ -881,8 +883,9 @@ impl OsStr {
881
883
///
882
884
/// Note: As the encoding is unspecified, any sub-slice of bytes that is not valid UTF-8 should
883
885
/// be treated as opaque and only comparable within the same rust version built for the same
884
- /// target platform. See [`OsString`] for more encoding details and [`std::ffi`] for
885
- /// platform-specific, specified conversions.
886
+ /// target platform. For example, sending the slice over the network or storing it in a file
887
+ /// will likely result in incompatible byte slices See [`OsString`] for more encoding details
888
+ /// and [`std::ffi`] for platform-specific, specified conversions.
886
889
///
887
890
/// [`std::ffi`]: crate::ffi
888
891
#[ inline]
You can’t perform that action at this time.
0 commit comments