Skip to content

Commit d5bdfbc

Browse files
ffi/c_str.rs: Make all descriptions have a single-sentence summary at the beginning
Per #44855 (comment) and subsequent ones.
1 parent d989cd0 commit d5bdfbc

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/libstd/ffi/c_str.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,12 @@ pub struct CStr {
208208
inner: [c_char]
209209
}
210210

211-
/// An error returned from [`CString::new`] to indicate that a nul byte was found
212-
/// in the vector provided. While Rust strings may contain nul bytes in the middle,
213-
/// C strings can't, as that byte would effectively truncate the string.
211+
/// An error indicating that an interior nul byte was found.
214212
///
215-
/// This `struct` is created by the [`new`][`CString::new`] method on
213+
/// While Rust strings may contain nul bytes in the middle, C strings
214+
/// can't, as that byte would effectively truncate the string.
215+
///
216+
/// This error is created by the [`new`][`CString::new`] method on
216217
/// [`CString`]. See its documentation for more.
217218
///
218219
/// [`CString`]: struct.CString.html
@@ -229,13 +230,12 @@ pub struct CStr {
229230
#[stable(feature = "rust1", since = "1.0.0")]
230231
pub struct NulError(usize, Vec<u8>);
231232

232-
/// An error returned from [`CStr::from_bytes_with_nul`] to indicate
233-
/// that a nul byte was found too early in the slice provided, or one
234-
/// wasn't found at all for the nul terminator. The slice used to
235-
/// create a `CStr` must have one and only one nul byte at the end of
236-
/// the slice.
233+
/// An error indicating that a nul byte was not in the expected position.
237234
///
238-
/// This `struct` is created by the
235+
/// The slice used to create a [`CStr`] must have one and only one nul
236+
/// byte at the end of the slice.
237+
///
238+
/// This error is created by the
239239
/// [`from_bytes_with_nul`][`CStr::from_bytes_with_nul`] method on
240240
/// [`CStr`]. See its documentation for more.
241241
///
@@ -274,16 +274,17 @@ impl FromBytesWithNulError {
274274
}
275275
}
276276

277-
/// An error returned from [`CString::into_string`] to indicate that a
278-
/// UTF-8 error was encountered during the conversion. `CString` is
279-
/// just a wrapper over a buffer of bytes with a nul terminator;
280-
/// [`into_string`][`CString::into_string`] performs UTF-8 validation
281-
/// and may return this error.
277+
/// An error indicating invalid UTF-8 when converting a [`CString`] into a [`String`].
278+
///
279+
/// `CString` is just a wrapper over a buffer of bytes with a nul
280+
/// terminator; [`into_string`][`CString::into_string`] performs UTF-8
281+
/// validation on those bytes and may return this error.
282282
///
283283
/// This `struct` is created by the
284284
/// [`into_string`][`CString::into_string`] method on [`CString`]. See
285285
/// its documentation for more.
286286
///
287+
/// [`String`]: ../string/struct.String.html
287288
/// [`CString`]: struct.CString.html
288289
/// [`CString::into_string`]: struct.CString.html#method.into_string
289290
#[derive(Clone, PartialEq, Eq, Debug)]

0 commit comments

Comments
 (0)