Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #30975

Merged
merged 16 commits into from
Jan 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ build.
Download [MinGW from
here](http://mingw-w64.org/doku.php/download/mingw-builds), and choose the
`threads=win32,exceptions=dwarf/seh` flavor when installing. After installing,
add its `bin` directory to your `PATH`. This is due to #28260, in the future,
add its `bin` directory to your `PATH`. This is due to [#28260](https://github.com/rust-lang/rust/issues/28260), in the future,
installing from pacman should be just fine.

```
Expand Down
12 changes: 10 additions & 2 deletions src/doc/nomicon/vec-final.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ impl<T> Iterator for RawValIter<T> {
} else {
unsafe {
let result = ptr::read(self.start);
self.start = self.start.offset(1);
self.start = if mem::size_of::<T>() == 0 {
(self.start as usize + 1) as *const _
} else {
self.start.offset(1)
};
Some(result)
}
}
Expand All @@ -246,7 +250,11 @@ impl<T> DoubleEndedIterator for RawValIter<T> {
None
} else {
unsafe {
self.end = self.end.offset(-1);
self.end = if mem::size_of::<T>() == 0 {
(self.end as usize - 1) as *const _
} else {
self.end.offset(-1)
};
Some(ptr::read(self.end))
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/doc/nomicon/vec-zsts.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ impl<T> Iterator for RawValIter<T> {
self.start = if mem::size_of::<T>() == 0 {
(self.start as usize + 1) as *const _
} else {
self.start.offset(1);
}
self.start.offset(1)
};
Some(result)
}
}
Expand All @@ -164,8 +164,8 @@ impl<T> DoubleEndedIterator for RawValIter<T> {
self.end = if mem::size_of::<T>() == 0 {
(self.end as usize - 1) as *const _
} else {
self.end.offset(-1);
}
self.end.offset(-1)
};
Some(ptr::read(self.end))
}
}
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
#![feature(custom_attribute)]
#![feature(fundamental)]
#![feature(lang_items)]
#![feature(num_bits_bytes)]
#![feature(optin_builtin_traits)]
#![feature(placement_in_syntax)]
#![feature(placement_new_protocol)]
Expand Down
3 changes: 1 addition & 2 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use super::oom;
use super::boxed::Box;
use core::ops::Drop;
use core::cmp;
use core;

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

#[inline]
fn alloc_guard(alloc_size: usize) {
if core::usize::BITS < 64 {
if mem::size_of::<usize>() < 8 {
assert!(alloc_size <= ::core::isize::MAX as usize,
"capacity overflow");
}
Expand Down
4 changes: 4 additions & 0 deletions src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,23 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned {
/// Trait for moving into a `Cow`.
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
issue = "27735")]
#[rustc_deprecated(since = "1.7.0",
reason = "conflicts with Into, may return with specialization")]
pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
/// Moves `self` into `Cow`
fn into_cow(self) -> Cow<'a, B>;
}

#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
fn into_cow(self) -> Cow<'a, B> {
self
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
fn as_ref(&self) -> &T {
self
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub trait CLike {
fn from_usize(usize) -> Self;
}

#[allow(deprecated)]
fn bit<E: CLike>(e: &E) -> usize {
use core::usize;
let value = e.to_usize();
Expand Down
6 changes: 5 additions & 1 deletion src/libcollections/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,11 @@ pub use core::fmt::{LowerExp, UpperExp};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::Error;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{ArgumentV1, Arguments, write, radix, Radix, RadixFmt};
pub use core::fmt::{ArgumentV1, Arguments, write};
#[unstable(feature = "fmt_radix", issue = "27728")]
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
#[allow(deprecated)]
pub use core::fmt::{radix, Radix, RadixFmt};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};

Expand Down
1 change: 0 additions & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#![feature(alloc)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(clone_from_slice)]
#![feature(core_intrinsics)]
#![feature(decode_utf16)]
#![feature(drop_in_place)]
Expand Down
33 changes: 13 additions & 20 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,15 +788,12 @@ impl<T> [T] {
/// # Examples
///
/// ```rust
/// #![feature(slice_sort_by_key)]
///
/// let mut v = [-5i32, 4, 1, -3, 2];
///
/// v.sort_by_key(|k| k.abs());
/// assert!(v == [1, 2, -3, 4, -5]);
/// ```
#[unstable(feature = "slice_sort_by_key", reason = "recently added",
issue = "27724")]
#[stable(feature = "slice_sort_by_key", since = "1.7.0")]
#[inline]
pub fn sort_by_key<B, F>(&mut self, mut f: F)
where F: FnMut(&T) -> B, B: Ord
Expand Down Expand Up @@ -829,29 +826,25 @@ impl<T> [T] {
merge_sort(self, compare)
}

/// Copies as many elements from `src` as it can into `self` (the
/// shorter of `self.len()` and `src.len()`). Returns the number
/// of elements copied.
/// Copies the elements from `src` into `self`.
///
/// The length of this slice must be the same as the slice passed in.
///
/// # Panics
///
/// This function will panic if the two slices have different lengths.
///
/// # Example
///
/// ```rust
/// #![feature(clone_from_slice)]
///
/// let mut dst = [0, 0, 0];
/// let src = [1, 2];
///
/// assert!(dst.clone_from_slice(&src) == 2);
/// assert!(dst == [1, 2, 0]);
/// let src = [1, 2, 3];
///
/// let src2 = [3, 4, 5, 6];
/// assert!(dst.clone_from_slice(&src2) == 3);
/// assert!(dst == [3, 4, 5]);
/// dst.clone_from_slice(&src);
/// assert!(dst == [1, 2, 3]);
/// ```
#[unstable(feature = "clone_from_slice", issue = "27750")]
pub fn clone_from_slice(&mut self, src: &[T]) -> usize
where T: Clone
{
#[stable(feature = "clone_from_slice", since = "1.7.0")]
pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
core_slice::SliceExt::clone_from_slice(self, src)
}

Expand Down
14 changes: 11 additions & 3 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ use core::str::pattern::Pattern;
use rustc_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
use rustc_unicode::str as unicode_str;

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

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

/// Extracts a string slice containing the entire string.
#[inline]
#[stable(feature = "string_as_str", since = "1.7.0")]
pub fn as_mut_str(&mut self) -> &mut str {
self
}

/// Appends a given string slice onto the end of this `String`.
///
/// # Examples
Expand Down Expand Up @@ -1794,6 +1800,7 @@ impl Into<Vec<u8>> for String {

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

#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
issue = "27735")]
#[allow(deprecated)]
impl<'a> IntoCow<'a, str> for &'a str {
#[inline]
fn into_cow(self) -> Cow<'a, str> {
Expand Down
11 changes: 5 additions & 6 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ use core::ops;
use core::ptr;
use core::slice;

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

use super::range::RangeArgument;
Expand Down Expand Up @@ -464,9 +465,7 @@ impl<T> Vec<T> {
///
/// Equivalent to `&s[..]`.
#[inline]
#[unstable(feature = "convert",
reason = "waiting on RFC revision",
issue = "27729")]
#[stable(feature = "vec_as_slice", since = "1.7.0")]
pub fn as_slice(&self) -> &[T] {
self
}
Expand All @@ -475,9 +474,7 @@ impl<T> Vec<T> {
///
/// Equivalent to `&mut s[..]`.
#[inline]
#[unstable(feature = "convert",
reason = "waiting on RFC revision",
issue = "27729")]
#[stable(feature = "vec_as_slice", since = "1.7.0")]
pub fn as_mut_slice(&mut self) -> &mut [T] {
&mut self[..]
}
Expand Down Expand Up @@ -1516,13 +1513,15 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> where T: Clone {
fn into_cow(self) -> Cow<'a, [T]> {
Cow::Owned(self)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone {
fn into_cow(self) -> Cow<'a, [T]> {
Cow::Borrowed(self)
Expand Down
6 changes: 4 additions & 2 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use core::mem;
use core::ops::{Index, IndexMut};
use core::ptr;
use core::slice;
use core::usize;

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

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

/// `VecDeque` is a growable ring buffer, which can be used as a double-ended
/// queue efficiently.
Expand Down
1 change: 1 addition & 0 deletions src/libcore/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
/// Returns the wrapped `Formatter`.
#[unstable(feature = "debug_builder_formatter", reason = "recently added",
issue = "27782")]
#[rustc_deprecated(since = "1.7.0", reason = "will be removed")]
pub fn formatter(&mut self) -> &mut fmt::Formatter<'b> {
&mut self.fmt
}
Expand Down
10 changes: 8 additions & 2 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ use str;
use self::rt::v1::Alignment;

#[unstable(feature = "fmt_radix", issue = "27728")]
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
#[allow(deprecated)]
pub use self::num::radix;
#[unstable(feature = "fmt_radix", issue = "27728")]
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
#[allow(deprecated)]
pub use self::num::Radix;
#[unstable(feature = "fmt_radix", issue = "27728")]
#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
#[allow(deprecated)]
pub use self::num::RadixFmt;
#[stable(feature = "debug_builders", since = "1.2.0")]
pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap};
Expand Down Expand Up @@ -1391,7 +1397,7 @@ impl<T> Pointer for *const T {
f.flags |= 1 << (FlagV1::SignAwareZeroPad as u32);

if let None = f.width {
f.width = Some((::usize::BITS/4) + 2);
f.width = Some(((mem::size_of::<usize>() * 8) / 4) + 2);
}
}
f.flags |= 1 << (FlagV1::Alternate as u32);
Expand Down Expand Up @@ -1532,7 +1538,7 @@ macro_rules! tuple {
( $($name:ident,)+ ) => (
#[stable(feature = "rust1", since = "1.0.0")]
impl<$($name:Debug),*> Debug for ($($name,)*) {
#[allow(non_snake_case, unused_assignments)]
#[allow(non_snake_case, unused_assignments, deprecated)]
fn fmt(&self, f: &mut Formatter) -> Result {
let mut builder = f.debug_tuple("");
let ($(ref $name,)*) = *self;
Expand Down
5 changes: 5 additions & 0 deletions src/libcore/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

//! Integer and floating-point number formatting

#![allow(deprecated)]

// FIXME: #6220 Implement floating point formatting

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

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