Skip to content

Commit

Permalink
Auto merge of #40748 - frewsxcv:rollup, r=frewsxcv
Browse files Browse the repository at this point in the history
Rollup of 13 pull requests

- Successful merges: #40509, #40523, #40548, #40578, #40619, #40689, #40690, #40692, #40704, #40722, #40723, #40725, #40732
- Failed merges:
  • Loading branch information
bors committed Mar 22, 2017
2 parents 8c4f2c6 + 0e57709 commit c62e532
Show file tree
Hide file tree
Showing 38 changed files with 232 additions and 113 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Read ["Installing Rust"] from [The Book].

1. Make sure you have installed the dependencies:

* `g++` 4.7 or later or `clang++` 3.x
* `g++` 4.7 or later or `clang++` 3.x or later
* `python` 2.7 (but not 3.x)
* GNU `make` 3.81 or later
* `cmake` 3.4.3 or later
Expand Down
17 changes: 12 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ environment:
# *not* use debug assertions and llvm assertions. This is because they take
# too long on appveyor and this is tested by rustbuild below.
- MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-ninja
SCRIPT: python x.py test
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
MINGW_DIR: mingw32
- MSYS_BITS: 64
SCRIPT: python x.py test
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-ninja
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
MINGW_DIR: mingw64
Expand All @@ -68,15 +68,15 @@ environment:
SCRIPT: python x.py dist
DEPLOY: 1
- MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended --enable-ninja
SCRIPT: python x.py dist
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
MINGW_DIR: mingw32
DEPLOY: 1
- MSYS_BITS: 64
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended --enable-ninja
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
MINGW_DIR: mingw64
Expand Down Expand Up @@ -116,9 +116,16 @@ install:

# Download and install sccache
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-pc-windows-msvc
- mv 2017-03-16-sccache-x86_64-pc-windows-msvc sccache
- mv 2017-03-16-sccache-x86_64-pc-windows-msvc sccache.exe
- set PATH=%PATH%;%CD%

# Download and install ninja
#
# Note that this is originally from the github releases patch of Ninja
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-15-ninja-win.zip
- 7z x 2017-03-15-ninja-win.zip
# - set PATH=%PATH%;%CD% -- this already happens above for sccache

# Install InnoSetup to get `iscc` used to produce installers
- appveyor-retry choco install -y InnoSetup
- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::process;
use num_cpus;
use rustc_serialize::Decodable;
use toml::{Parser, Decoder, Value};
use util::push_exe_path;
use util::{exe, push_exe_path};

/// Global configuration for the entire build and/or bootstrap.
///
Expand Down Expand Up @@ -584,10 +584,10 @@ impl Config {
self.python = Some(path);
}
"CFG_ENABLE_CCACHE" if value == "1" => {
self.ccache = Some("ccache".to_string());
self.ccache = Some(exe("ccache", &self.build));
}
"CFG_ENABLE_SCCACHE" if value == "1" => {
self.ccache = Some("sccache".to_string());
self.ccache = Some(exe("sccache", &self.build));
}
"CFG_CONFIGURE_ARGS" if value.len() > 0 => {
self.configure_args = value.split_whitespace()
Expand Down
31 changes: 31 additions & 0 deletions src/doc/unstable-book/src/sort-unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,35 @@ The tracking issue for this feature is: [#40585]

------------------------

The default `sort` method on slices is stable. In other words, it guarantees
that the original order of equal elements is preserved after sorting. The
method has several undesirable characteristics:

1. It allocates a sizable chunk of memory.
2. If you don't need stability, it is not as performant as it could be.

An alternative is the new `sort_unstable` feature, which includes these
methods for sorting slices:

1. `sort_unstable`
2. `sort_unstable_by`
3. `sort_unstable_by_key`

Unstable sorting is generally faster and makes no allocations. The majority
of real-world sorting needs doesn't require stability, so these methods can
very often come in handy.

Another important difference is that `sort` lives in `libstd` and
`sort_unstable` lives in `libcore`. The reason is that the former makes
allocations and the latter doesn't.

A simple example:

```rust
#![feature(sort_unstable)]

let mut v = [-5, 4, 1, -3, 2];

v.sort_unstable();
assert!(v == [-5, -3, 1, 2, 4]);
```
4 changes: 2 additions & 2 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,13 @@ impl<'a, T> Hole<'a, T> {
self.pos
}

/// Return a reference to the element removed
/// Returns a reference to the element removed.
#[inline]
fn element(&self) -> &T {
self.elt.as_ref().unwrap()
}

/// Return a reference to the element at `index`.
/// Returns a reference to the element at `index`.
///
/// Unsafe because index must be within the data slice and not equal to pos.
#[inline]
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
}
}

/// Returns true if the map contains a value for the specified key.
/// Returns `true` if the map contains a value for the specified key.
///
/// The key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
Expand Down Expand Up @@ -1965,7 +1965,7 @@ impl<K, V> BTreeMap<K, V> {
self.length
}

/// Returns true if the map contains no elements.
/// Returns `true` if the map contains no elements.
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ impl<T: Ord> BTreeSet<T> {
self.map.len()
}

/// Returns true if the set contains no elements.
/// Returns `true` if the set contains no elements.
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl<E: CLike> EnumSet<E> {
self.bits.count_ones() as usize
}

/// Returns true if the `EnumSet` is empty.
/// Returns `true` if the `EnumSet` is empty.
pub fn is_empty(&self) -> bool {
self.bits == 0
}
Expand Down
8 changes: 4 additions & 4 deletions src/libcollections/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use Bound::{self, Excluded, Included, Unbounded};
/// **RangeArgument** is implemented by Rust's built-in range types, produced
/// by range syntax like `..`, `a..`, `..b` or `c..d`.
pub trait RangeArgument<T: ?Sized> {
/// Start index bound
/// Start index bound.
///
/// Return start value as a `Bound`
/// Returns the start value as a `Bound`.
///
/// # Examples
///
Expand All @@ -42,9 +42,9 @@ pub trait RangeArgument<T: ?Sized> {
/// ```
fn start(&self) -> Bound<&T>;

/// End index bound
/// End index bound.
///
/// Return end value as a `Bound`
/// Returns the end value as a `Bound`.
///
/// # Examples
///
Expand Down
37 changes: 18 additions & 19 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl<T> [T] {
core_slice::SliceExt::is_empty(self)
}

/// Returns the first element of a slice, or `None` if it is empty.
/// Returns the first element of the slice, or `None` if it is empty.
///
/// # Examples
///
Expand All @@ -212,7 +212,7 @@ impl<T> [T] {
core_slice::SliceExt::first(self)
}

/// Returns a mutable pointer to the first element of a slice, or `None` if it is empty.
/// Returns a mutable pointer to the first element of the slice, or `None` if it is empty.
///
/// # Examples
///
Expand All @@ -230,7 +230,7 @@ impl<T> [T] {
core_slice::SliceExt::first_mut(self)
}

/// Returns the first and all the rest of the elements of a slice, or `None` if it is empty.
/// Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
///
/// # Examples
///
Expand All @@ -248,7 +248,7 @@ impl<T> [T] {
core_slice::SliceExt::split_first(self)
}

/// Returns the first and all the rest of the elements of a slice, or `None` if it is empty.
/// Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
///
/// # Examples
///
Expand All @@ -268,7 +268,7 @@ impl<T> [T] {
core_slice::SliceExt::split_first_mut(self)
}

/// Returns the last and all the rest of the elements of a slice, or `None` if it is empty.
/// Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
///
/// # Examples
///
Expand All @@ -287,7 +287,7 @@ impl<T> [T] {

}

/// Returns the last and all the rest of the elements of a slice, or `None` if it is empty.
/// Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
///
/// # Examples
///
Expand All @@ -307,7 +307,7 @@ impl<T> [T] {
core_slice::SliceExt::split_last_mut(self)
}

/// Returns the last element of a slice, or `None` if it is empty.
/// Returns the last element of the slice, or `None` if it is empty.
///
/// # Examples
///
Expand Down Expand Up @@ -485,7 +485,7 @@ impl<T> [T] {
core_slice::SliceExt::as_mut_ptr(self)
}

/// Swaps two elements in a slice.
/// Swaps two elements in the slice.
///
/// # Arguments
///
Expand All @@ -509,7 +509,7 @@ impl<T> [T] {
core_slice::SliceExt::swap(self, a, b)
}

/// Reverses the order of elements in a slice, in place.
/// Reverses the order of elements in the slice, in place.
///
/// # Example
///
Expand Down Expand Up @@ -955,7 +955,7 @@ impl<T> [T] {
core_slice::SliceExt::ends_with(self, needle)
}

/// Binary search a sorted slice for a given element.
/// Binary searches this sorted slice for a given element.
///
/// If the value is found then `Ok` is returned, containing the
/// index of the matching element; if the value is not found then
Expand Down Expand Up @@ -984,7 +984,7 @@ impl<T> [T] {
core_slice::SliceExt::binary_search(self, x)
}

/// Binary search a sorted slice with a comparator function.
/// Binary searches this sorted slice with a comparator function.
///
/// The comparator function should implement an order consistent
/// with the sort order of the underlying slice, returning an
Expand Down Expand Up @@ -1023,7 +1023,7 @@ impl<T> [T] {
core_slice::SliceExt::binary_search_by(self, f)
}

/// Binary search a sorted slice with a key extraction function.
/// Binary searches this sorted slice with a key extraction function.
///
/// Assumes that the slice is sorted by the key, for instance with
/// [`sort_by_key`] using the same key extraction function.
Expand Down Expand Up @@ -1092,7 +1092,7 @@ impl<T> [T] {
merge_sort(self, |a, b| a.lt(b));
}

/// Sorts the slice using `compare` to compare elements.
/// Sorts the slice with a comparator function.
///
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
///
Expand Down Expand Up @@ -1125,7 +1125,7 @@ impl<T> [T] {
merge_sort(self, |a, b| compare(a, b) == Less);
}

/// Sorts the slice using `f` to extract a key to compare elements by.
/// Sorts the slice with a key extraction function.
///
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
///
Expand Down Expand Up @@ -1191,8 +1191,8 @@ impl<T> [T] {
core_slice::SliceExt::sort_unstable(self);
}

/// Sorts the slice using `compare` to compare elements, but may not preserve the order of
/// equal elements.
/// Sorts the slice with a comparator function, but may not preserve the order of equal
/// elements.
///
/// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
/// and `O(n log n)` worst-case.
Expand Down Expand Up @@ -1231,8 +1231,8 @@ impl<T> [T] {
core_slice::SliceExt::sort_unstable_by(self, compare);
}

/// Sorts the slice using `f` to extract a key to compare elements by, but may not preserve the
/// order of equal elements.
/// Sorts the slice with a key extraction function, but may not preserve the order of equal
/// elements.
///
/// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
/// and `O(n log n)` worst-case.
Expand Down Expand Up @@ -1313,7 +1313,6 @@ impl<T> [T] {
core_slice::SliceExt::copy_from_slice(self, src)
}


/// Copies `self` into a new `Vec`.
///
/// # Examples
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl str {
core_str::StrExt::len(self)
}

/// Returns true if this slice has a length of zero bytes.
/// Returns `true` if `self` has a length of zero bytes.
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl<T> VecDeque<T> {
ptr::write(self.ptr().offset(off as isize), value);
}

/// Returns true if and only if the buffer is at capacity
/// Returns `true` if and only if the buffer is at full capacity.
#[inline]
fn is_full(&self) -> bool {
self.cap() - self.len() == 1
Expand Down Expand Up @@ -788,7 +788,7 @@ impl<T> VecDeque<T> {
count(self.tail, self.head, self.cap())
}

/// Returns true if the buffer contains no elements
/// Returns `true` if the `VecDeque` is empty.
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl fmt::Debug for Any + Send {
}

impl Any {
/// Returns true if the boxed type is the same as `T`.
/// Returns `true` if the boxed type is the same as `T`.
///
/// # Examples
///
Expand Down
Loading

0 comments on commit c62e532

Please sign in to comment.