Skip to content

Commit 506bc06

Browse files
authored
Unrolled build for #148826
Rollup merge of #148826 - btj:cstr-docs, r=joboet CStr docs: Fix CStr vs &CStr confusion The CStr documentation used to say things about CStr that are only true for &CStr. Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
2 parents 6d41834 + a56fc9c commit 506bc06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/core/src/ffi/c_str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ use crate::{fmt, ops, slice, str};
1515
// actually reference libstd or liballoc in intra-doc links. so, the best we can do is remove the
1616
// links to `CString` and `String` for now until a solution is developed
1717

18-
/// Representation of a borrowed C string.
18+
/// A dynamically-sized view of a C string.
1919
///
20-
/// This type represents a borrowed reference to a nul-terminated
20+
/// The type `&CStr` represents a reference to a borrowed nul-terminated
2121
/// array of bytes. It can be constructed safely from a <code>&[[u8]]</code>
2222
/// slice, or unsafely from a raw `*const c_char`. It can be expressed as a
2323
/// literal in the form `c"Hello world"`.
2424
///
25-
/// The `CStr` can then be converted to a Rust <code>&[str]</code> by performing
25+
/// The `&CStr` can then be converted to a Rust <code>&[str]</code> by performing
2626
/// UTF-8 validation, or into an owned `CString`.
2727
///
2828
/// `&CStr` is to `CString` as <code>&[str]</code> is to `String`: the former
29-
/// in each pair are borrowed references; the latter are owned
29+
/// in each pair are borrowing references; the latter are owned
3030
/// strings.
3131
///
3232
/// Note that this structure does **not** have a guaranteed layout (the `repr(transparent)`

0 commit comments

Comments
 (0)