Skip to content

Commit c62e532

Browse files
committed
Auto merge of #40748 - frewsxcv:rollup, r=frewsxcv
Rollup of 13 pull requests - Successful merges: #40509, #40523, #40548, #40578, #40619, #40689, #40690, #40692, #40704, #40722, #40723, #40725, #40732 - Failed merges:
2 parents 8c4f2c6 + 0e57709 commit c62e532

38 files changed

+232
-113
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Read ["Installing Rust"] from [The Book].
1616

1717
1. Make sure you have installed the dependencies:
1818

19-
* `g++` 4.7 or later or `clang++` 3.x
19+
* `g++` 4.7 or later or `clang++` 3.x or later
2020
* `python` 2.7 (but not 3.x)
2121
* GNU `make` 3.81 or later
2222
* `cmake` 3.4.3 or later

appveyor.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ environment:
4343
# *not* use debug assertions and llvm assertions. This is because they take
4444
# too long on appveyor and this is tested by rustbuild below.
4545
- MSYS_BITS: 32
46-
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
46+
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-ninja
4747
SCRIPT: python x.py test
4848
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
4949
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
5050
MINGW_DIR: mingw32
5151
- MSYS_BITS: 64
5252
SCRIPT: python x.py test
53-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
53+
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-ninja
5454
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
5555
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
5656
MINGW_DIR: mingw64
@@ -68,15 +68,15 @@ environment:
6868
SCRIPT: python x.py dist
6969
DEPLOY: 1
7070
- MSYS_BITS: 32
71-
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended
71+
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended --enable-ninja
7272
SCRIPT: python x.py dist
7373
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
7474
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
7575
MINGW_DIR: mingw32
7676
DEPLOY: 1
7777
- MSYS_BITS: 64
7878
SCRIPT: python x.py dist
79-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended
79+
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended --enable-ninja
8080
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
8181
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
8282
MINGW_DIR: mingw64
@@ -116,9 +116,16 @@ install:
116116

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

122+
# Download and install ninja
123+
#
124+
# Note that this is originally from the github releases patch of Ninja
125+
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-15-ninja-win.zip
126+
- 7z x 2017-03-15-ninja-win.zip
127+
# - set PATH=%PATH%;%CD% -- this already happens above for sccache
128+
122129
# Install InnoSetup to get `iscc` used to produce installers
123130
- appveyor-retry choco install -y InnoSetup
124131
- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%

src/bootstrap/config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::process;
2323
use num_cpus;
2424
use rustc_serialize::Decodable;
2525
use toml::{Parser, Decoder, Value};
26-
use util::push_exe_path;
26+
use util::{exe, push_exe_path};
2727

2828
/// Global configuration for the entire build and/or bootstrap.
2929
///
@@ -584,10 +584,10 @@ impl Config {
584584
self.python = Some(path);
585585
}
586586
"CFG_ENABLE_CCACHE" if value == "1" => {
587-
self.ccache = Some("ccache".to_string());
587+
self.ccache = Some(exe("ccache", &self.build));
588588
}
589589
"CFG_ENABLE_SCCACHE" if value == "1" => {
590-
self.ccache = Some("sccache".to_string());
590+
self.ccache = Some(exe("sccache", &self.build));
591591
}
592592
"CFG_CONFIGURE_ARGS" if value.len() > 0 => {
593593
self.configure_args = value.split_whitespace()

src/doc/unstable-book/src/sort-unstable.md

+31
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,35 @@ The tracking issue for this feature is: [#40585]
66

77
------------------------
88

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

13+
1. It allocates a sizable chunk of memory.
14+
2. If you don't need stability, it is not as performant as it could be.
15+
16+
An alternative is the new `sort_unstable` feature, which includes these
17+
methods for sorting slices:
18+
19+
1. `sort_unstable`
20+
2. `sort_unstable_by`
21+
3. `sort_unstable_by_key`
22+
23+
Unstable sorting is generally faster and makes no allocations. The majority
24+
of real-world sorting needs doesn't require stability, so these methods can
25+
very often come in handy.
26+
27+
Another important difference is that `sort` lives in `libstd` and
28+
`sort_unstable` lives in `libcore`. The reason is that the former makes
29+
allocations and the latter doesn't.
30+
31+
A simple example:
32+
33+
```rust
34+
#![feature(sort_unstable)]
35+
36+
let mut v = [-5, 4, 1, -3, 2];
37+
38+
v.sort_unstable();
39+
assert!(v == [-5, -3, 1, 2, 4]);
40+
```

src/libcollections/binary_heap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -930,13 +930,13 @@ impl<'a, T> Hole<'a, T> {
930930
self.pos
931931
}
932932

933-
/// Return a reference to the element removed
933+
/// Returns a reference to the element removed.
934934
#[inline]
935935
fn element(&self) -> &T {
936936
self.elt.as_ref().unwrap()
937937
}
938938

939-
/// Return a reference to the element at `index`.
939+
/// Returns a reference to the element at `index`.
940940
///
941941
/// Unsafe because index must be within the data slice and not equal to pos.
942942
#[inline]

src/libcollections/btree/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
526526
}
527527
}
528528

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

1968-
/// Returns true if the map contains no elements.
1968+
/// Returns `true` if the map contains no elements.
19691969
///
19701970
/// # Examples
19711971
///

src/libcollections/btree/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl<T: Ord> BTreeSet<T> {
415415
self.map.len()
416416
}
417417

418-
/// Returns true if the set contains no elements.
418+
/// Returns `true` if the set contains no elements.
419419
///
420420
/// # Examples
421421
///

src/libcollections/enum_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<E: CLike> EnumSet<E> {
106106
self.bits.count_ones() as usize
107107
}
108108

109-
/// Returns true if the `EnumSet` is empty.
109+
/// Returns `true` if the `EnumSet` is empty.
110110
pub fn is_empty(&self) -> bool {
111111
self.bits == 0
112112
}

src/libcollections/range.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ use Bound::{self, Excluded, Included, Unbounded};
2020
/// **RangeArgument** is implemented by Rust's built-in range types, produced
2121
/// by range syntax like `..`, `a..`, `..b` or `c..d`.
2222
pub trait RangeArgument<T: ?Sized> {
23-
/// Start index bound
23+
/// Start index bound.
2424
///
25-
/// Return start value as a `Bound`
25+
/// Returns the start value as a `Bound`.
2626
///
2727
/// # Examples
2828
///
@@ -42,9 +42,9 @@ pub trait RangeArgument<T: ?Sized> {
4242
/// ```
4343
fn start(&self) -> Bound<&T>;
4444

45-
/// End index bound
45+
/// End index bound.
4646
///
47-
/// Return end value as a `Bound`
47+
/// Returns the end value as a `Bound`.
4848
///
4949
/// # Examples
5050
///

src/libcollections/slice.rs

+18-19
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<T> [T] {
195195
core_slice::SliceExt::is_empty(self)
196196
}
197197

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

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

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

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

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

288288
}
289289

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

310-
/// Returns the last element of a slice, or `None` if it is empty.
310+
/// Returns the last element of the slice, or `None` if it is empty.
311311
///
312312
/// # Examples
313313
///
@@ -485,7 +485,7 @@ impl<T> [T] {
485485
core_slice::SliceExt::as_mut_ptr(self)
486486
}
487487

488-
/// Swaps two elements in a slice.
488+
/// Swaps two elements in the slice.
489489
///
490490
/// # Arguments
491491
///
@@ -509,7 +509,7 @@ impl<T> [T] {
509509
core_slice::SliceExt::swap(self, a, b)
510510
}
511511

512-
/// Reverses the order of elements in a slice, in place.
512+
/// Reverses the order of elements in the slice, in place.
513513
///
514514
/// # Example
515515
///
@@ -955,7 +955,7 @@ impl<T> [T] {
955955
core_slice::SliceExt::ends_with(self, needle)
956956
}
957957

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

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

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

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

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

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

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

1316-
13171316
/// Copies `self` into a new `Vec`.
13181317
///
13191318
/// # Examples

src/libcollections/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl str {
204204
core_str::StrExt::len(self)
205205
}
206206

207-
/// Returns true if this slice has a length of zero bytes.
207+
/// Returns `true` if `self` has a length of zero bytes.
208208
///
209209
/// # Examples
210210
///

src/libcollections/vec_deque.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<T> VecDeque<T> {
133133
ptr::write(self.ptr().offset(off as isize), value);
134134
}
135135

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

791-
/// Returns true if the buffer contains no elements
791+
/// Returns `true` if the `VecDeque` is empty.
792792
///
793793
/// # Examples
794794
///

src/libcore/any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl fmt::Debug for Any + Send {
137137
}
138138

139139
impl Any {
140-
/// Returns true if the boxed type is the same as `T`.
140+
/// Returns `true` if the boxed type is the same as `T`.
141141
///
142142
/// # Examples
143143
///

0 commit comments

Comments
 (0)