Skip to content

Commit

Permalink
Rollup merge of rust-lang#39307 - alexcrichton:stabilize-1.16, r=brson
Browse files Browse the repository at this point in the history
std: Stabilize APIs for the 1.16.0 release

This commit applies the stabilization/deprecations of the 1.16.0 release, as
tracked by the rust-lang/rust issue tracker and the final-comment-period tag.

The following APIs were stabilized:

* `VecDeque::truncate`
* `VecDeque::resize`
* `String::insert_str`
* `Duration::checked_{add,sub,div,mul}`
* `str::replacen`
* `SocketAddr::is_ipv{4,6}`
* `IpAddr::is_ipv{4,6}`
* `str::repeat`
* `Vec::dedup_by`
* `Vec::dedup_by_key`
* `Result::unwrap_or_default`
* `<*const T>::wrapping_offset`
* `<*mut T>::wrapping_offset`
* `CommandExt::creation_flags` (on Windows)
* `File::set_permissions`
* `String::split_off`

The following APIs were deprecated

* `EnumSet` - replaced with other ecosystem abstractions, long since unstable

Closes rust-lang#27788
Closes rust-lang#35553
Closes rust-lang#35774
Closes rust-lang#36436
Closes rust-lang#36949
Closes rust-lang#37079
Closes rust-lang#37087
Closes rust-lang#37516
Closes rust-lang#37827
Closes rust-lang#37916
Closes rust-lang#37966
Closes rust-lang#38080
  • Loading branch information
alexcrichton committed Jan 28, 2017
2 parents 13e3b36 + 671b1c1 commit 0edc3d3
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 371 deletions.
2 changes: 2 additions & 0 deletions src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
reason = "matches collection reform specification, \
waiting for dust to settle",
issue = "37966")]
#![rustc_deprecated(since = "1.16.0", reason = "long since replaced")]
#![allow(deprecated)]

use core::marker;
use core::fmt;
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub use btree_set::BTreeSet;
#[doc(no_inline)]
pub use linked_list::LinkedList;
#[doc(no_inline)]
#[allow(deprecated)]
pub use enum_set::EnumSet;
#[doc(no_inline)]
pub use vec_deque::VecDeque;
Expand Down
10 changes: 2 additions & 8 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,6 @@ impl str {
/// Basic usage:
///
/// ```
/// # #![feature(str_replacen)]
/// let s = "foo foo 123 foo";
/// assert_eq!("new new 123 foo", s.replacen("foo", "new", 2));
/// assert_eq!("faa fao 123 foo", s.replacen('o', "a", 3));
Expand All @@ -1617,13 +1616,10 @@ impl str {
/// When the pattern doesn't match:
///
/// ```
/// # #![feature(str_replacen)]
/// let s = "this is old";
/// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10));
/// ```
#[unstable(feature = "str_replacen",
issue = "36436",
reason = "only need to replace first N matches")]
#[stable(feature = "str_replacen", since = "1.16.0")]
pub fn replacen<'a, P: Pattern<'a>>(&'a self, pat: P, to: &str, count: usize) -> String {
// Hope to reduce the times of re-allocation
let mut result = String::with_capacity(32);
Expand Down Expand Up @@ -1795,11 +1791,9 @@ impl str {
/// Basic usage:
///
/// ```
/// #![feature(repeat_str)]
///
/// assert_eq!("abc".repeat(4), String::from("abcabcabcabc"));
/// ```
#[unstable(feature = "repeat_str", issue = "37079")]
#[stable(feature = "repeat_str", since = "1.16.0")]
pub fn repeat(&self, n: usize) -> String {
let mut s = String::with_capacity(self.len() * n);
s.extend((0..n).map(|_| self));
Expand Down
9 changes: 2 additions & 7 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,18 +1166,14 @@ impl String {
/// Basic usage:
///
/// ```
/// #![feature(insert_str)]
///
/// let mut s = String::from("bar");
///
/// s.insert_str(0, "foo");
///
/// assert_eq!("foobar", s);
/// ```
#[inline]
#[unstable(feature = "insert_str",
reason = "recent addition",
issue = "35553")]
#[stable(feature = "insert_str", since = "1.16.0")]
pub fn insert_str(&mut self, idx: usize, string: &str) {
assert!(self.is_char_boundary(idx));

Expand Down Expand Up @@ -1270,7 +1266,6 @@ impl String {
/// # Examples
///
/// ```
/// # #![feature(string_split_off)]
/// # fn main() {
/// let mut hello = String::from("Hello, World!");
/// let world = hello.split_off(7);
Expand All @@ -1279,7 +1274,7 @@ impl String {
/// # }
/// ```
#[inline]
#[unstable(feature = "string_split_off", issue = "38080")]
#[stable(feature = "string_split_off", since = "1.16.0")]
pub fn split_off(&mut self, mid: usize) -> String {
assert!(self.is_char_boundary(mid));
let other = self.vec.split_off(mid);
Expand Down
7 changes: 2 additions & 5 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,15 +820,13 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// #![feature(dedup_by)]
///
/// let mut vec = vec![10, 20, 21, 30, 20];
///
/// vec.dedup_by_key(|i| *i / 10);
///
/// assert_eq!(vec, [10, 20, 30, 20]);
/// ```
#[unstable(feature = "dedup_by", reason = "recently added", issue = "37087")]
#[stable(feature = "dedup_by", since = "1.16.0")]
#[inline]
pub fn dedup_by_key<F, K>(&mut self, mut key: F) where F: FnMut(&mut T) -> K, K: PartialEq {
self.dedup_by(|a, b| key(a) == key(b))
Expand All @@ -841,7 +839,6 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// #![feature(dedup_by)]
/// use std::ascii::AsciiExt;
///
/// let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"];
Expand All @@ -850,7 +847,7 @@ impl<T> Vec<T> {
///
/// assert_eq!(vec, ["foo", "bar", "baz", "bar"]);
/// ```
#[unstable(feature = "dedup_by", reason = "recently added", issue = "37087")]
#[stable(feature = "dedup_by", since = "1.16.0")]
pub fn dedup_by<F>(&mut self, mut same_bucket: F) where F: FnMut(&mut T, &mut T) -> bool {
unsafe {
// Although we have a mutable reference to `self`, we cannot make
Expand Down
12 changes: 2 additions & 10 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,6 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// #![feature(deque_extras)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand All @@ -655,9 +653,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(buf.len(), 1);
/// assert_eq!(Some(&5), buf.get(0));
/// ```
#[unstable(feature = "deque_extras",
reason = "matches collection reform specification; waiting on panic semantics",
issue = "27788")]
#[stable(feature = "deque_extras", since = "1.16.0")]
pub fn truncate(&mut self, len: usize) {
for _ in len..self.len() {
self.pop_back();
Expand Down Expand Up @@ -1779,8 +1775,6 @@ impl<T: Clone> VecDeque<T> {
/// # Examples
///
/// ```
/// #![feature(deque_extras)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand All @@ -1793,9 +1787,7 @@ impl<T: Clone> VecDeque<T> {
/// assert_eq!(a, b);
/// }
/// ```
#[unstable(feature = "deque_extras",
reason = "matches collection reform specification; waiting on panic semantics",
issue = "27788")]
#[stable(feature = "deque_extras", since = "1.16.0")]
pub fn resize(&mut self, new_len: usize, value: T) {
let len = self.len();

Expand Down
Loading

0 comments on commit 0edc3d3

Please sign in to comment.