Skip to content

Commit

Permalink
partially stabilize (const_)slice_ptr_len by stabilizing `NonNull::…
Browse files Browse the repository at this point in the history
…len` #71146
  • Loading branch information
Pointerbender committed Mar 5, 2022
1 parent 86067bb commit 613f569
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,15 @@ impl<T> NonNull<[T]> {
/// # Examples
///
/// ```rust
/// #![feature(slice_ptr_len, nonnull_slice_from_raw_parts)]
/// #![feature(nonnull_slice_from_raw_parts)]
/// use std::ptr::NonNull;
///
/// let slice: NonNull<[i8]> = NonNull::slice_from_raw_parts(NonNull::dangling(), 3);
/// assert_eq!(slice.len(), 3);
/// ```
#[unstable(feature = "slice_ptr_len", issue = "71146")]
#[rustc_const_unstable(feature = "const_slice_ptr_len", issue = "71146")]
#[stable(feature = "slice_ptr_len_nonnull", since = "1.61.0")]
#[rustc_const_stable(feature = "const_slice_ptr_len_nonnull", since = "1.61.0")]
#[rustc_allow_const_fn_unstable(const_slice_ptr_len)]
#[must_use]
#[inline]
pub const fn len(self) -> usize {
Expand Down

0 comments on commit 613f569

Please sign in to comment.