Skip to content

Commit 7b932d2

Browse files
committed
stabilized vec_splice (fixes rust-lang#32310)
1 parent ae8efdc commit 7b932d2

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/doc/unstable-book/src/library-features/splice.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ The tracking issue for this feature is: [#32310]
66

77
------------------------
88

9-
The `splice()` method on `Vec` and `String` allows you to replace a range
10-
of values in a vector or string with another range of values, and returns
9+
The `splice()` method on `String` allows you to replace a range
10+
of values in a string with another range of values, and returns
1111
the replaced values.
1212

1313
A simple example:
@@ -20,4 +20,4 @@ let beta_offset = s.find('β').unwrap_or(s.len());
2020
// Replace the range up until the β from the string
2121
s.splice(..beta_offset, "Α is capital alpha; ");
2222
assert_eq!(s, "Α is capital alpha; β is beta");
23-
```
23+
```

src/liballoc/vec.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,15 +1943,14 @@ impl<T> Vec<T> {
19431943
/// # Examples
19441944
///
19451945
/// ```
1946-
/// #![feature(splice)]
19471946
/// let mut v = vec![1, 2, 3];
19481947
/// let new = [7, 8];
19491948
/// let u: Vec<_> = v.splice(..2, new.iter().cloned()).collect();
19501949
/// assert_eq!(v, &[7, 8, 3]);
19511950
/// assert_eq!(u, &[1, 2]);
19521951
/// ```
19531952
#[inline]
1954-
#[unstable(feature = "splice", reason = "recently added", issue = "32310")]
1953+
#[stable(feature = "vec_splice", since = "1.22.0")]
19551954
pub fn splice<R, I>(&mut self, range: R, replace_with: I) -> Splice<I::IntoIter>
19561955
where R: RangeArgument<usize>, I: IntoIterator<Item=T>
19571956
{
@@ -2554,13 +2553,13 @@ impl<'a, T> InPlace<T> for PlaceBack<'a, T> {
25542553
/// [`splice()`]: struct.Vec.html#method.splice
25552554
/// [`Vec`]: struct.Vec.html
25562555
#[derive(Debug)]
2557-
#[unstable(feature = "splice", reason = "recently added", issue = "32310")]
2556+
#[stable(feature = "vec_splice", since = "1.22.0")]
25582557
pub struct Splice<'a, I: Iterator + 'a> {
25592558
drain: Drain<'a, I::Item>,
25602559
replace_with: I,
25612560
}
25622561

2563-
#[unstable(feature = "splice", reason = "recently added", issue = "32310")]
2562+
#[stable(feature = "vec_splice", since = "1.22.0")]
25642563
impl<'a, I: Iterator> Iterator for Splice<'a, I> {
25652564
type Item = I::Item;
25662565

@@ -2573,18 +2572,18 @@ impl<'a, I: Iterator> Iterator for Splice<'a, I> {
25732572
}
25742573
}
25752574

2576-
#[unstable(feature = "splice", reason = "recently added", issue = "32310")]
2575+
#[stable(feature = "vec_splice", since = "1.22.0")]
25772576
impl<'a, I: Iterator> DoubleEndedIterator for Splice<'a, I> {
25782577
fn next_back(&mut self) -> Option<Self::Item> {
25792578
self.drain.next_back()
25802579
}
25812580
}
25822581

2583-
#[unstable(feature = "splice", reason = "recently added", issue = "32310")]
2582+
#[stable(feature = "vec_splice", since = "1.22.0")]
25842583
impl<'a, I: Iterator> ExactSizeIterator for Splice<'a, I> {}
25852584

25862585

2587-
#[unstable(feature = "splice", reason = "recently added", issue = "32310")]
2586+
#[stable(feature = "vec_splice", since = "1.22.0")]
25882587
impl<'a, I: Iterator> Drop for Splice<'a, I> {
25892588
fn drop(&mut self) {
25902589
// exhaust drain first

0 commit comments

Comments
 (0)