Skip to content

Commit e821731

Browse files
authored
Rollup merge of #150777 - stabilize_elem_offset, r=jhpratt
Stabilize `slice::element_offset` [slice::element_offset](https://doc.rust-lang.org/std/primitive.slice.html#method.element_offset) Partially stabilizes #126769 (substr_range). [FCP completed](#126769 (comment)) The other methods are [stalled because of the new range types](#126769 (comment)), but this method doesn't use ranges.
2 parents 40e95e5 + 5548a84 commit e821731

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

library/core/src/slice/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4809,8 +4809,6 @@ impl<T> [T] {
48094809
/// # Examples
48104810
/// Basic usage:
48114811
/// ```
4812-
/// #![feature(substr_range)]
4813-
///
48144812
/// let nums: &[u32] = &[1, 7, 1, 1];
48154813
/// let num = &nums[2];
48164814
///
@@ -4819,8 +4817,6 @@ impl<T> [T] {
48194817
/// ```
48204818
/// Returning `None` with an unaligned element:
48214819
/// ```
4822-
/// #![feature(substr_range)]
4823-
///
48244820
/// let arr: &[[u32; 2]] = &[[0, 1], [2, 3]];
48254821
/// let flat_arr: &[u32] = arr.as_flattened();
48264822
///
@@ -4834,7 +4830,7 @@ impl<T> [T] {
48344830
/// assert_eq!(arr.element_offset(weird_elm), None); // Points between element 0 and 1
48354831
/// ```
48364832
#[must_use]
4837-
#[unstable(feature = "substr_range", issue = "126769")]
4833+
#[stable(feature = "element_offset", since = "CURRENT_RUSTC_VERSION")]
48384834
pub fn element_offset(&self, element: &T) -> Option<usize> {
48394835
if T::IS_ZST {
48404836
panic!("elements are zero-sized");

0 commit comments

Comments
 (0)