Skip to content

Commit ca8d13d

Browse files
authored
Rollup merge of rust-lang#82771 - emilio:iter-mut-as-slice, r=m-ou-se
slice: Stabilize IterMut::as_slice. Much like rust-lang#72584. As per rust-lang#58957 there's no blocker for this, and I wanted to use this today :-) Closes rust-lang#58957
2 parents c19664d + 2bd7c1b commit ca8d13d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

library/core/src/slice/iter.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ impl<'a, T> IterMut<'a, T> {
286286
/// Basic usage:
287287
///
288288
/// ```
289-
/// # #![feature(slice_iter_mut_as_slice)]
290289
/// let mut slice: &mut [usize] = &mut [1, 2, 3];
291290
///
292291
/// // First, we get the iterator:
@@ -299,12 +298,19 @@ impl<'a, T> IterMut<'a, T> {
299298
/// // Now `as_slice` returns "[2, 3]":
300299
/// assert_eq!(iter.as_slice(), &[2, 3]);
301300
/// ```
302-
#[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "58957")]
301+
#[stable(feature = "slice_iter_mut_as_slice", since = "1.53.0")]
303302
pub fn as_slice(&self) -> &[T] {
304303
self.make_slice()
305304
}
306305
}
307306

307+
#[stable(feature = "slice_iter_mut_as_slice", since = "1.53.0")]
308+
impl<T> AsRef<[T]> for IterMut<'_, T> {
309+
fn as_ref(&self) -> &[T] {
310+
self.as_slice()
311+
}
312+
}
313+
308314
iterator! {struct IterMut -> *mut T, &'a mut T, mut, {mut}, {}}
309315

310316
/// An internal abstraction over the splitting iterators, so that

0 commit comments

Comments
 (0)