This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -678,8 +678,10 @@ impl OsStr {
678678 /// `OsStr`'s encoding is an unspecified superset of UTF-8 and callers must
679679 /// pass in bytes that originated as a mixture of validated UTF-8 and bytes from
680680 /// [`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
683685 ///
684686 /// # Example
685687 ///
@@ -881,8 +883,9 @@ impl OsStr {
881883 ///
882884 /// Note: As the encoding is unspecified, any sub-slice of bytes that is not valid UTF-8 should
883885 /// 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.
886889 ///
887890 /// [`std::ffi`]: crate::ffi
888891 #[ inline]
You can’t perform that action at this time.
0 commit comments