Skip to content

Commit

Permalink
Unrolled build for rust-lang#118956
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#118956 - danielhuang:patch-2, r=workingjubilee

Make CStr documentation consistent ("nul" instead of "null")

"nul" is used in method names and appears more often in the documentation than "null", so make all instances "nul" to keep it consistent.
  • Loading branch information
rust-timer authored Dec 16, 2023
2 parents a96d57b + f2f9b1d commit 7a4cff4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl CString {
/// Failure to call [`CString::from_raw`] will lead to a memory leak.
///
/// The C side must **not** modify the length of the string (by writing a
/// `null` somewhere inside the string or removing the final one) before
/// nul byte somewhere inside the string or removing the final one) before
/// it makes it back into Rust using [`CString::from_raw`]. See the safety section
/// in [`CString::from_raw`].
///
Expand Down Expand Up @@ -797,7 +797,7 @@ impl From<Box<CStr>> for CString {
#[stable(feature = "cstring_from_vec_of_nonzerou8", since = "1.43.0")]
impl From<Vec<NonZeroU8>> for CString {
/// Converts a <code>[Vec]<[NonZeroU8]></code> into a [`CString`] without
/// copying nor checking for inner null bytes.
/// copying nor checking for inner nul bytes.
#[inline]
fn from(v: Vec<NonZeroU8>) -> CString {
unsafe {
Expand All @@ -809,7 +809,7 @@ impl From<Vec<NonZeroU8>> for CString {
let (ptr, len, cap): (*mut NonZeroU8, _, _) = Vec::into_raw_parts(v);
Vec::from_raw_parts(ptr.cast::<u8>(), len, cap)
};
// SAFETY: `v` cannot contain null bytes, given the type-level
// SAFETY: `v` cannot contain nul bytes, given the type-level
// invariant of `NonZeroU8`.
Self::_from_vec_unchecked(v)
}
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl CStr {
/// * The memory pointed to by `ptr` must contain a valid nul terminator at the
/// end of the string.
///
/// * `ptr` must be [valid] for reads of bytes up to and including the null terminator.
/// * `ptr` must be [valid] for reads of bytes up to and including the nul terminator.
/// This means in particular:
///
/// * The entire memory range of this `CStr` must be contained within a single allocated object!
Expand Down Expand Up @@ -415,7 +415,7 @@ impl CStr {
let mut i = bytes.len().saturating_sub(1);
assert!(!bytes.is_empty() && bytes[i] == 0, "input was not nul-terminated");

// Ending null byte exists, skip to the rest.
// Ending nul byte exists, skip to the rest.
while i != 0 {
i -= 1;
let byte = bytes[i];
Expand Down

0 comments on commit 7a4cff4

Please sign in to comment.