Skip to content

Commit bb73eab

Browse files
committed
Adjust documentation for some pointer-to-slice methods
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`
1 parent fd3fb2e commit bb73eab

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

library/core/src/ptr/const_ptr.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ impl<T> *const [T] {
913913
/// The returned value is the number of **elements**, not the number of bytes.
914914
///
915915
/// This function is safe, even when the raw slice cannot be cast to a slice
916-
/// reference because the pointer is null or unaligned.
916+
/// reference (e.g. because the pointer is null or unaligned).
917917
///
918918
/// # Examples
919919
///
@@ -1037,8 +1037,8 @@ impl *const str {
10371037
///
10381038
/// The returned value is the number of **bytes**, not the number of characters.
10391039
///
1040-
/// This function is safe, even when the raw string slice cannot be cast to a slice
1041-
/// reference because the pointer is null or unaligned.
1040+
/// This function is safe, even when the raw string slice cannot be cast to a string slice
1041+
/// reference (e.g. because the pointer is null or unaligned).
10421042
///
10431043
/// # Examples
10441044
///
@@ -1085,9 +1085,6 @@ impl *const str {
10851085
///
10861086
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
10871087
///
1088-
/// Note that calling this function with an index that does not lie on an UTF-8 sequence boundaries
1089-
/// is safe, but dereferencing the pointer returned by such call is unsound.
1090-
///
10911088
/// # Examples
10921089
///
10931090
/// ```

library/core/src/ptr/mut_ptr.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ impl<T> *mut [T] {
11761176
/// The returned value is the number of **elements**, not the number of bytes.
11771177
///
11781178
/// This function is safe, even when the raw slice cannot be cast to a slice
1179-
/// reference because the pointer is null or unaligned.
1179+
/// reference (e.g. because the pointer is null or unaligned).
11801180
///
11811181
/// # Examples
11821182
///
@@ -1353,8 +1353,8 @@ impl *mut str {
13531353
///
13541354
/// The returned value is the number of **bytes**, not the number of characters.
13551355
///
1356-
/// This function is safe, even when the raw string slice cannot be cast to a slice
1357-
/// reference because the pointer is null or unaligned.
1356+
/// This function is safe, even when the raw string slice cannot be cast to a string slice
1357+
/// reference (e.g. because the pointer is null or unaligned).
13581358
///
13591359
/// # Examples
13601360
///
@@ -1406,9 +1406,6 @@ impl *mut str {
14061406
///
14071407
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
14081408
///
1409-
/// Note that calling this function with an index that does not lie on an UTF-8 sequence boundaries
1410-
/// is safe, but dereferencing the pointer returned by such call is unsound.
1411-
///
14121409
/// # Examples
14131410
///
14141411
/// ```

library/core/src/ptr/non_null.rs

-3
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,6 @@ impl NonNull<str> {
708708
///
709709
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
710710
///
711-
/// Note that calling this function with an index that does not lie on an UTF-8 sequence boundaries
712-
/// is safe, but dereferencing the pointer returned by such call is unsound.
713-
///
714711
/// # Examples
715712
///
716713
/// ```

0 commit comments

Comments
 (0)