about summary refs log tree commit diff
path: root/src/libcore/ptr
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2020-05-07 07:47:24 +0200
committerSimon Sapin <simon.sapin@exyr.org>2020-05-18 21:29:43 +0200
commit861dfaa855ba61bdc8eaccc0652e6fdb8eadf4c3 (patch)
treee126b9ffe0ceb3d46a4c54efb03e7fbc3e7b4844 /src/libcore/ptr
parent49d5f5a977a1c0e0dffc8e189cef1977476f5253 (diff)
downloadrust-861dfaa855ba61bdc8eaccc0652e6fdb8eadf4c3.tar.gz
rust-861dfaa855ba61bdc8eaccc0652e6fdb8eadf4c3.zip
Apply suggestions from code review
Co-authored-by: kennytm <kennytm@gmail.com>
Diffstat (limited to 'src/libcore/ptr')
-rw-r--r--src/libcore/ptr/non_null.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/ptr/non_null.rs b/src/libcore/ptr/non_null.rs
index ed99452397f..870364a61dd 100644
--- a/src/libcore/ptr/non_null.rs
+++ b/src/libcore/ptr/non_null.rs
@@ -143,7 +143,7 @@ impl<T: ?Sized> NonNull<T> {
 }
 
 impl<T> NonNull<[T]> {
-    /// Create a non-null raw slice from a thin pointer and a length.
+    /// Creates a non-null raw slice from a thin pointer and a length.
     ///
     /// The `len` argument is the number of **elements**, not the number of bytes.
     ///
@@ -171,12 +171,12 @@ impl<T> NonNull<[T]> {
     #[unstable(feature = "nonnull_slice_from_raw_parts", issue = "71941")]
     #[rustc_const_unstable(feature = "const_nonnull_slice_from_raw_parts", issue = "71941")]
     #[inline]
-    pub const fn slice_from_raw_parts(data: NonNull<T>, size: usize) -> Self {
+    pub const fn slice_from_raw_parts(data: NonNull<T>, len: usize) -> Self {
         // SAFETY: `data` is a `NonNull` pointer which is necessarily non-null
-        unsafe { Self::new_unchecked(super::slice_from_raw_parts_mut(data.as_ptr(), size)) }
+        unsafe { Self::new_unchecked(super::slice_from_raw_parts_mut(data.as_ptr(), len)) }
     }
 
-    /// Return the length and a non-null raw slice.
+    /// Returns the length of a non-null raw slice.
     ///
     /// The returned value is the number of **elements**, not the number of bytes.
     ///