1
Fork 0

Rollup merge of #57656 - scottmcm:deprecate-resize_default, r=SimonSapin

Deprecate the unstable Vec::resize_default

As a way to either get additional feedback to stabilize or help move nightly users off it.

Tracking issue: https://github.com/rust-lang/rust/issues/41758#issuecomment-449719961

r? @SimonSapin
This commit is contained in:
Mazdak Farrokhzad 2019-02-22 14:57:55 +01:00 committed by GitHub
commit 0bcb66469c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1365,6 +1365,7 @@ impl<T: Default> Vec<T> {
/// # Examples
///
/// ```
/// # #![allow(deprecated)]
/// #![feature(vec_resize_default)]
///
/// let mut vec = vec![1, 2, 3];
@ -1381,6 +1382,9 @@ impl<T: Default> Vec<T> {
/// [`Default`]: ../../std/default/trait.Default.html
/// [`Clone`]: ../../std/clone/trait.Clone.html
#[unstable(feature = "vec_resize_default", issue = "41758")]
#[rustc_deprecated(reason = "This is moving towards being removed in favor \
of `.resize_with(Default::default)`. If you disagree, please comment \
in the tracking issue.", since = "1.33.0")]
pub fn resize_default(&mut self, new_len: usize) {
let len = self.len();