Skip to content

Commit 80e21d1

Browse files
committed
Rollup merge of #30943 - alexcrichton:stabilize-1.7, r=aturon
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2 parents fbf3e96 + 9a4f43b commit 80e21d1

File tree

58 files changed

+356
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+356
-235
lines changed

src/liballoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
#![feature(custom_attribute)]
7979
#![feature(fundamental)]
8080
#![feature(lang_items)]
81-
#![feature(num_bits_bytes)]
8281
#![feature(optin_builtin_traits)]
8382
#![feature(placement_in_syntax)]
8483
#![feature(placement_new_protocol)]

src/liballoc/raw_vec.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use super::oom;
1616
use super::boxed::Box;
1717
use core::ops::Drop;
1818
use core::cmp;
19-
use core;
2019

2120
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating a
2221
/// a buffer of memory on the heap without having to worry about all the corner cases
@@ -584,7 +583,7 @@ impl<T> Drop for RawVec<T> {
584583

585584
#[inline]
586585
fn alloc_guard(alloc_size: usize) {
587-
if core::usize::BITS < 64 {
586+
if mem::size_of::<usize>() < 8 {
588587
assert!(alloc_size <= ::core::isize::MAX as usize,
589588
"capacity overflow");
590589
}

src/libcollections/borrow.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,23 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned {
247247
/// Trait for moving into a `Cow`.
248248
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
249249
issue = "27735")]
250+
#[rustc_deprecated(since = "1.7.0",
251+
reason = "conflicts with Into, may return with specialization")]
250252
pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
251253
/// Moves `self` into `Cow`
252254
fn into_cow(self) -> Cow<'a, B>;
253255
}
254256

255257
#[stable(feature = "rust1", since = "1.0.0")]
258+
#[allow(deprecated)]
256259
impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
257260
fn into_cow(self) -> Cow<'a, B> {
258261
self
259262
}
260263
}
261264

262265
#[stable(feature = "rust1", since = "1.0.0")]
266+
#[allow(deprecated)]
263267
impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
264268
fn as_ref(&self) -> &T {
265269
self

src/libcollections/enum_set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub trait CLike {
8181
fn from_usize(usize) -> Self;
8282
}
8383

84+
#[allow(deprecated)]
8485
fn bit<E: CLike>(e: &E) -> usize {
8586
use core::usize;
8687
let value = e.to_usize();

src/libcollections/fmt.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,11 @@ pub use core::fmt::{LowerExp, UpperExp};
490490
#[stable(feature = "rust1", since = "1.0.0")]
491491
pub use core::fmt::Error;
492492
#[stable(feature = "rust1", since = "1.0.0")]
493-
pub use core::fmt::{ArgumentV1, Arguments, write, radix, Radix, RadixFmt};
493+
pub use core::fmt::{ArgumentV1, Arguments, write};
494+
#[unstable(feature = "fmt_radix", issue = "27728")]
495+
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
496+
#[allow(deprecated)]
497+
pub use core::fmt::{radix, Radix, RadixFmt};
494498
#[stable(feature = "rust1", since = "1.0.0")]
495499
pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
496500

src/libcollections/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#![feature(alloc)]
3333
#![feature(box_patterns)]
3434
#![feature(box_syntax)]
35-
#![feature(clone_from_slice)]
3635
#![feature(core_intrinsics)]
3736
#![feature(decode_utf16)]
3837
#![feature(drop_in_place)]

src/libcollections/slice.rs

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -788,15 +788,12 @@ impl<T> [T] {
788788
/// # Examples
789789
///
790790
/// ```rust
791-
/// #![feature(slice_sort_by_key)]
792-
///
793791
/// let mut v = [-5i32, 4, 1, -3, 2];
794792
///
795793
/// v.sort_by_key(|k| k.abs());
796794
/// assert!(v == [1, 2, -3, 4, -5]);
797795
/// ```
798-
#[unstable(feature = "slice_sort_by_key", reason = "recently added",
799-
issue = "27724")]
796+
#[stable(feature = "slice_sort_by_key", since = "1.7.0")]
800797
#[inline]
801798
pub fn sort_by_key<B, F>(&mut self, mut f: F)
802799
where F: FnMut(&T) -> B, B: Ord
@@ -829,29 +826,25 @@ impl<T> [T] {
829826
merge_sort(self, compare)
830827
}
831828

832-
/// Copies as many elements from `src` as it can into `self` (the
833-
/// shorter of `self.len()` and `src.len()`). Returns the number
834-
/// of elements copied.
829+
/// Copies the elements from `src` into `self`.
830+
///
831+
/// The length of this slice must be the same as the slice passed in.
832+
///
833+
/// # Panics
834+
///
835+
/// This function will panic if the two slices have different lengths.
835836
///
836837
/// # Example
837838
///
838839
/// ```rust
839-
/// #![feature(clone_from_slice)]
840-
///
841840
/// let mut dst = [0, 0, 0];
842-
/// let src = [1, 2];
843-
///
844-
/// assert!(dst.clone_from_slice(&src) == 2);
845-
/// assert!(dst == [1, 2, 0]);
841+
/// let src = [1, 2, 3];
846842
///
847-
/// let src2 = [3, 4, 5, 6];
848-
/// assert!(dst.clone_from_slice(&src2) == 3);
849-
/// assert!(dst == [3, 4, 5]);
843+
/// dst.clone_from_slice(&src);
844+
/// assert!(dst == [1, 2, 3]);
850845
/// ```
851-
#[unstable(feature = "clone_from_slice", issue = "27750")]
852-
pub fn clone_from_slice(&mut self, src: &[T]) -> usize
853-
where T: Clone
854-
{
846+
#[stable(feature = "clone_from_slice", since = "1.7.0")]
847+
pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
855848
core_slice::SliceExt::clone_from_slice(self, src)
856849
}
857850

src/libcollections/string.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ use core::str::pattern::Pattern;
6666
use rustc_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
6767
use rustc_unicode::str as unicode_str;
6868

69+
#[allow(deprecated)]
6970
use borrow::{Cow, IntoCow};
7071
use range::RangeArgument;
7172
use str::{self, FromStr, Utf8Error, Chars};
@@ -783,13 +784,18 @@ impl String {
783784

784785
/// Extracts a string slice containing the entire string.
785786
#[inline]
786-
#[unstable(feature = "convert",
787-
reason = "waiting on RFC revision",
788-
issue = "27729")]
787+
#[stable(feature = "string_as_str", since = "1.7.0")]
789788
pub fn as_str(&self) -> &str {
790789
self
791790
}
792791

792+
/// Extracts a string slice containing the entire string.
793+
#[inline]
794+
#[stable(feature = "string_as_str", since = "1.7.0")]
795+
pub fn as_mut_str(&mut self) -> &mut str {
796+
self
797+
}
798+
793799
/// Appends a given string slice onto the end of this `String`.
794800
///
795801
/// # Examples
@@ -1794,6 +1800,7 @@ impl Into<Vec<u8>> for String {
17941800

17951801
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
17961802
issue= "27735")]
1803+
#[allow(deprecated)]
17971804
impl IntoCow<'static, str> for String {
17981805
#[inline]
17991806
fn into_cow(self) -> Cow<'static, str> {
@@ -1803,6 +1810,7 @@ impl IntoCow<'static, str> for String {
18031810

18041811
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
18051812
issue = "27735")]
1813+
#[allow(deprecated)]
18061814
impl<'a> IntoCow<'a, str> for &'a str {
18071815
#[inline]
18081816
fn into_cow(self) -> Cow<'a, str> {

src/libcollections/vec.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ use core::ops;
7373
use core::ptr;
7474
use core::slice;
7575

76+
#[allow(deprecated)]
7677
use borrow::{Cow, IntoCow};
7778

7879
use super::range::RangeArgument;
@@ -464,9 +465,7 @@ impl<T> Vec<T> {
464465
///
465466
/// Equivalent to `&s[..]`.
466467
#[inline]
467-
#[unstable(feature = "convert",
468-
reason = "waiting on RFC revision",
469-
issue = "27729")]
468+
#[stable(feature = "vec_as_slice", since = "1.7.0")]
470469
pub fn as_slice(&self) -> &[T] {
471470
self
472471
}
@@ -475,9 +474,7 @@ impl<T> Vec<T> {
475474
///
476475
/// Equivalent to `&mut s[..]`.
477476
#[inline]
478-
#[unstable(feature = "convert",
479-
reason = "waiting on RFC revision",
480-
issue = "27729")]
477+
#[stable(feature = "vec_as_slice", since = "1.7.0")]
481478
pub fn as_mut_slice(&mut self) -> &mut [T] {
482479
&mut self[..]
483480
}
@@ -1516,13 +1513,15 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
15161513
}
15171514

15181515
#[stable(feature = "rust1", since = "1.0.0")]
1516+
#[allow(deprecated)]
15191517
impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> where T: Clone {
15201518
fn into_cow(self) -> Cow<'a, [T]> {
15211519
Cow::Owned(self)
15221520
}
15231521
}
15241522

15251523
#[stable(feature = "rust1", since = "1.0.0")]
1524+
#[allow(deprecated)]
15261525
impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone {
15271526
fn into_cow(self) -> Cow<'a, [T]> {
15281527
Cow::Borrowed(self)

src/libcollections/vec_deque.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use core::mem;
2525
use core::ops::{Index, IndexMut};
2626
use core::ptr;
2727
use core::slice;
28-
use core::usize;
2928

3029
use core::hash::{Hash, Hasher};
3130
use core::cmp;
@@ -36,7 +35,10 @@ use super::range::RangeArgument;
3635

3736
const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
3837
const MINIMUM_CAPACITY: usize = 1; // 2 - 1
39-
const MAXIMUM_ZST_CAPACITY: usize = 1 << (usize::BITS - 1); // Largest possible power of two
38+
#[cfg(target_pointer_width = "32")]
39+
const MAXIMUM_ZST_CAPACITY: usize = 1 << (32 - 1); // Largest possible power of two
40+
#[cfg(target_pointer_width = "64")]
41+
const MAXIMUM_ZST_CAPACITY: usize = 1 << (64 - 1); // Largest possible power of two
4042

4143
/// `VecDeque` is a growable ring buffer, which can be used as a double-ended
4244
/// queue efficiently.

0 commit comments

Comments
 (0)