Skip to content

Commit

Permalink
Rollup merge of rust-lang#57002 - scottmcm:stabilize-resize_with, r=r…
Browse files Browse the repository at this point in the history
…kruppe

Stabilize Vec(Deque)::resize_with

Closes rust-lang#41758
  • Loading branch information
pietroalbini committed Dec 21, 2018
2 parents 4abcd26 + 7b6cf6e commit bc674ab
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1897,8 +1897,6 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// #![feature(vec_resize_with)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand All @@ -1917,7 +1915,7 @@ impl<T> VecDeque<T> {
/// buf.resize_with(5, || { state += 1; state });
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
/// ```
#[unstable(feature = "vec_resize_with", issue = "41758")]
#[stable(feature = "vec_resize_with", since = "1.33.0")]
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
let len = self.len();

Expand Down
4 changes: 1 addition & 3 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,6 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// #![feature(vec_resize_with)]
///
/// let mut vec = vec![1, 2, 3];
/// vec.resize_with(5, Default::default);
/// assert_eq!(vec, [1, 2, 3, 0, 0]);
Expand All @@ -1255,7 +1253,7 @@ impl<T> Vec<T> {
///
/// [`resize`]: #method.resize
/// [`Clone`]: ../../std/clone/trait.Clone.html
#[unstable(feature = "vec_resize_with", issue = "41758")]
#[stable(feature = "vec_resize_with", since = "1.33.0")]
pub fn resize_with<F>(&mut self, new_len: usize, f: F)
where F: FnMut() -> T
{
Expand Down
1 change: 0 additions & 1 deletion src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#![feature(optin_builtin_traits)]
#![feature(nll)]
#![feature(allow_internal_unstable)]
#![feature(vec_resize_with)]
#![feature(hash_raw_entry)]
#![feature(stmt_expr_attributes)]
#![feature(core_intrinsics)]
Expand Down

0 comments on commit bc674ab

Please sign in to comment.