diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-05-26 03:38:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-26 03:38:17 +0200 |
| commit | 9aae60befc0ebafa21233827d7046187a0396a3d (patch) | |
| tree | 78aebad1fdc5c58afcc096ac205f47a4b4f00fc1 /library/std/src/ffi/os_str.rs | |
| parent | 6257d2fb1c8f673b1abb20d155bac80a2a80937c (diff) | |
| parent | 8f0522dc811b7132c3bd2b2bc5c134a869824cf3 (diff) | |
| download | rust-9aae60befc0ebafa21233827d7046187a0396a3d.tar.gz rust-9aae60befc0ebafa21233827d7046187a0396a3d.zip | |
Rollup merge of #140936 - teor2345:wtf-surrogate-docs, r=workingjubilee
Clarify WTF-8 safety docs This PR is a follow-up to PR #140159, which clarifies ~~two things~~: - the WTF-8 safety comment [was confusing](https://github.com/rust-lang/rust/pull/140159#discussion_r2082766965), either surrogate condition is actually sufficient for safety, both are not required - ~~the private `os_str::Slice` type name is easily confused with `std::slice`~~ ~~Happy to bikeshed the `OsSlice` name, other alternatives are `OsStrSlice` and `StrSlice`. Now it's got a distinct name from `std::slice`, it's easy to search and replace.~~ cc ``@thaliaarchi`` ``@workingjubilee``
Diffstat (limited to 'library/std/src/ffi/os_str.rs')
| -rw-r--r-- | library/std/src/ffi/os_str.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index ead48775127..b0580b467be 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -594,9 +594,9 @@ impl OsString { /// The slice must be valid for the platform encoding (as described in /// [`OsStr::from_encoded_bytes_unchecked`]). /// - /// This bypasses the encoding-dependent surrogate joining, so `self` must - /// not end with a leading surrogate half and `other` must not start with - /// with a trailing surrogate half. + /// This bypasses the encoding-dependent surrogate joining, so either + /// `self` must not end with a leading surrogate half, or `other` must not + /// start with a trailing surrogate half. #[inline] pub(crate) unsafe fn extend_from_slice_unchecked(&mut self, other: &[u8]) { // SAFETY: Guaranteed by caller. |
