Skip to content

Commit bff5292

Browse files
committed
Auto merge of #30975 - Manishearth:rollup, r=Manishearth
- Successful merges: #30938, #30940, #30943, #30949, #30952, #30957, #30959 - Failed merges:
2 parents 0b524ed + 00a4eea commit bff5292

Some content is hidden

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

68 files changed

+417
-250
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ build.
7878
Download [MinGW from
7979
here](http://mingw-w64.org/doku.php/download/mingw-builds), and choose the
8080
`threads=win32,exceptions=dwarf/seh` flavor when installing. After installing,
81-
add its `bin` directory to your `PATH`. This is due to #28260, in the future,
81+
add its `bin` directory to your `PATH`. This is due to [#28260](https://github.com/rust-lang/rust/issues/28260), in the future,
8282
installing from pacman should be just fine.
8383
8484
```

Diff for: src/doc/nomicon/vec-final.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@ impl<T> Iterator for RawValIter<T> {
226226
} else {
227227
unsafe {
228228
let result = ptr::read(self.start);
229-
self.start = self.start.offset(1);
229+
self.start = if mem::size_of::<T>() == 0 {
230+
(self.start as usize + 1) as *const _
231+
} else {
232+
self.start.offset(1)
233+
};
230234
Some(result)
231235
}
232236
}
@@ -246,7 +250,11 @@ impl<T> DoubleEndedIterator for RawValIter<T> {
246250
None
247251
} else {
248252
unsafe {
249-
self.end = self.end.offset(-1);
253+
self.end = if mem::size_of::<T>() == 0 {
254+
(self.end as usize - 1) as *const _
255+
} else {
256+
self.end.offset(-1)
257+
};
250258
Some(ptr::read(self.end))
251259
}
252260
}

Diff for: src/doc/nomicon/vec-zsts.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ impl<T> Iterator for RawValIter<T> {
140140
self.start = if mem::size_of::<T>() == 0 {
141141
(self.start as usize + 1) as *const _
142142
} else {
143-
self.start.offset(1);
144-
}
143+
self.start.offset(1)
144+
};
145145
Some(result)
146146
}
147147
}
@@ -164,8 +164,8 @@ impl<T> DoubleEndedIterator for RawValIter<T> {
164164
self.end = if mem::size_of::<T>() == 0 {
165165
(self.end as usize - 1) as *const _
166166
} else {
167-
self.end.offset(-1);
168-
}
167+
self.end.offset(-1)
168+
};
169169
Some(ptr::read(self.end))
170170
}
171171
}

Diff for: src/liballoc/lib.rs

-1
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)]

Diff for: src/liballoc/raw_vec.rs

+1-2
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
}

Diff for: src/libcollections/borrow.rs

+4
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

Diff for: src/libcollections/enum_set.rs

+1
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();

Diff for: src/libcollections/fmt.rs

+5-1
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

Diff for: src/libcollections/lib.rs

-1
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)]

Diff for: src/libcollections/slice.rs

+13-20
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

Diff for: src/libcollections/string.rs

+11-3
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> {

Diff for: src/libcollections/vec.rs

+5-6
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)

Diff for: src/libcollections/vec_deque.rs

+4-2
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.

Diff for: src/libcore/fmt/builders.rs

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
181181
/// Returns the wrapped `Formatter`.
182182
#[unstable(feature = "debug_builder_formatter", reason = "recently added",
183183
issue = "27782")]
184+
#[rustc_deprecated(since = "1.7.0", reason = "will be removed")]
184185
pub fn formatter(&mut self) -> &mut fmt::Formatter<'b> {
185186
&mut self.fmt
186187
}

Diff for: src/libcore/fmt/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@ use str;
2525
use self::rt::v1::Alignment;
2626

2727
#[unstable(feature = "fmt_radix", issue = "27728")]
28+
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
29+
#[allow(deprecated)]
2830
pub use self::num::radix;
2931
#[unstable(feature = "fmt_radix", issue = "27728")]
32+
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
33+
#[allow(deprecated)]
3034
pub use self::num::Radix;
3135
#[unstable(feature = "fmt_radix", issue = "27728")]
36+
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
37+
#[allow(deprecated)]
3238
pub use self::num::RadixFmt;
3339
#[stable(feature = "debug_builders", since = "1.2.0")]
3440
pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap};
@@ -1391,7 +1397,7 @@ impl<T> Pointer for *const T {
13911397
f.flags |= 1 << (FlagV1::SignAwareZeroPad as u32);
13921398

13931399
if let None = f.width {
1394-
f.width = Some((::usize::BITS/4) + 2);
1400+
f.width = Some(((mem::size_of::<usize>() * 8) / 4) + 2);
13951401
}
13961402
}
13971403
f.flags |= 1 << (FlagV1::Alternate as u32);
@@ -1532,7 +1538,7 @@ macro_rules! tuple {
15321538
( $($name:ident,)+ ) => (
15331539
#[stable(feature = "rust1", since = "1.0.0")]
15341540
impl<$($name:Debug),*> Debug for ($($name,)*) {
1535-
#[allow(non_snake_case, unused_assignments)]
1541+
#[allow(non_snake_case, unused_assignments, deprecated)]
15361542
fn fmt(&self, f: &mut Formatter) -> Result {
15371543
let mut builder = f.debug_tuple("");
15381544
let ($(ref $name,)*) = *self;

Diff for: src/libcore/fmt/num.rs

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
//! Integer and floating-point number formatting
1212
13+
#![allow(deprecated)]
14+
1315
// FIXME: #6220 Implement floating point formatting
1416

1517
use prelude::v1::*;
@@ -143,6 +145,7 @@ radix! { UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x,
143145
#[unstable(feature = "fmt_radix",
144146
reason = "may be renamed or move to a different module",
145147
issue = "27728")]
148+
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
146149
pub struct Radix {
147150
base: u8,
148151
}
@@ -173,6 +176,7 @@ impl GenericRadix for Radix {
173176
#[unstable(feature = "fmt_radix",
174177
reason = "may be renamed or move to a different module",
175178
issue = "27728")]
179+
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
176180
#[derive(Copy, Clone)]
177181
pub struct RadixFmt<T, R>(T, R);
178182

@@ -189,6 +193,7 @@ pub struct RadixFmt<T, R>(T, R);
189193
#[unstable(feature = "fmt_radix",
190194
reason = "may be renamed or move to a different module",
191195
issue = "27728")]
196+
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
192197
pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
193198
RadixFmt(x, Radix::new(base))
194199
}

0 commit comments

Comments
 (0)