This commit is contained in:
Trevor Spiteri 2022-08-25 12:54:30 +02:00
parent 97c963d081
commit bc3d7199e1
2 changed files with 6 additions and 2 deletions

View File

@ -137,7 +137,6 @@
#![feature(const_size_of_val)]
#![feature(const_slice_from_raw_parts_mut)]
#![feature(const_slice_ptr_len)]
#![feature(const_slice_split_at_not_mut)]
#![feature(const_str_from_utf8_unchecked_mut)]
#![feature(const_swap)]
#![feature(const_trait_impl)]
@ -150,6 +149,7 @@
#![feature(maybe_uninit_uninit_array)]
#![feature(ptr_metadata)]
#![feature(slice_ptr_get)]
#![feature(slice_split_at_unchecked)]
#![feature(str_internals)]
#![feature(utf16_extra)]
#![feature(utf16_extra_const)]

View File

@ -1624,10 +1624,14 @@ impl<T> [T] {
/// }
/// ```
#[unstable(feature = "slice_split_at_unchecked", reason = "new API", issue = "76014")]
#[rustc_const_unstable(feature = "const_slice_split_at_not_mut", issue = "none")]
#[rustc_const_unstable(feature = "slice_split_at_unchecked", issue = "76014")]
#[inline]
#[must_use]
pub const unsafe fn split_at_unchecked(&self, mid: usize) -> (&[T], &[T]) {
// HACK: the const function `from_raw_parts` is used to make this
// function const; previously the implementation used
// `(self.get_unchecked(..mid), self.get_unchecked(mid..))`
let len = self.len();
let ptr = self.as_ptr();