Skip to content

Commit

Permalink
Adjust documentation for some pointer-to-slice methods
Browse files Browse the repository at this point in the history
This commit changes documentation of the following methods as proposed
by the PR review
- `<*const [T]>::len`
- `<*mut [T]>::len`
- `<*const str>::len`
- `<*mut str>::len`
- `<*const str>::get_unchecked`
- `<*mut str>::get_unchecked_mut`
- `NonNull::<str>::get_unchecked_mut`
  • Loading branch information
WaffleLapkin committed Dec 17, 2021
1 parent fd3fb2e commit bb73eab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
9 changes: 3 additions & 6 deletions library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ impl<T> *const [T] {
/// The returned value is the number of **elements**, not the number of bytes.
///
/// This function is safe, even when the raw slice cannot be cast to a slice
/// reference because the pointer is null or unaligned.
/// reference (e.g. because the pointer is null or unaligned).
///
/// # Examples
///
Expand Down Expand Up @@ -1037,8 +1037,8 @@ impl *const str {
///
/// The returned value is the number of **bytes**, not the number of characters.
///
/// This function is safe, even when the raw string slice cannot be cast to a slice
/// reference because the pointer is null or unaligned.
/// This function is safe, even when the raw string slice cannot be cast to a string slice
/// reference (e.g. because the pointer is null or unaligned).
///
/// # Examples
///
Expand Down Expand Up @@ -1085,9 +1085,6 @@ impl *const str {
///
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
///
/// Note that calling this function with an index that does not lie on an UTF-8 sequence boundaries
/// is safe, but dereferencing the pointer returned by such call is unsound.
///
/// # Examples
///
/// ```
Expand Down
9 changes: 3 additions & 6 deletions library/core/src/ptr/mut_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ impl<T> *mut [T] {
/// The returned value is the number of **elements**, not the number of bytes.
///
/// This function is safe, even when the raw slice cannot be cast to a slice
/// reference because the pointer is null or unaligned.
/// reference (e.g. because the pointer is null or unaligned).
///
/// # Examples
///
Expand Down Expand Up @@ -1353,8 +1353,8 @@ impl *mut str {
///
/// The returned value is the number of **bytes**, not the number of characters.
///
/// This function is safe, even when the raw string slice cannot be cast to a slice
/// reference because the pointer is null or unaligned.
/// This function is safe, even when the raw string slice cannot be cast to a string slice
/// reference (e.g. because the pointer is null or unaligned).
///
/// # Examples
///
Expand Down Expand Up @@ -1406,9 +1406,6 @@ impl *mut str {
///
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
///
/// Note that calling this function with an index that does not lie on an UTF-8 sequence boundaries
/// is safe, but dereferencing the pointer returned by such call is unsound.
///
/// # Examples
///
/// ```
Expand Down
3 changes: 0 additions & 3 deletions library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,6 @@ impl NonNull<str> {
///
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
///
/// Note that calling this function with an index that does not lie on an UTF-8 sequence boundaries
/// is safe, but dereferencing the pointer returned by such call is unsound.
///
/// # Examples
///
/// ```
Expand Down

0 comments on commit bb73eab

Please sign in to comment.