Skip to content

Clarify WTF-8 safety docs #140936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions library/std/src/sys/os_str/wtf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ impl Buf {
/// The slice must be valid for the platform encoding (as described in
/// [`Slice::from_encoded_bytes_unchecked`]).
///
/// This bypasses the WTF-8 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 WTF-8 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 unsafe fn extend_from_slice_unchecked(&mut self, other: &[u8]) {
self.inner.extend_from_slice(other);
Expand Down
Loading