Skip to content

Commit 9f45c66

Browse files
committed
---
yaml --- r: 274529 b: refs/heads/stable c: 8fc73c7 h: refs/heads/master i: 274527: 14b8b6c
1 parent 3f101c3 commit 9f45c66

File tree

97 files changed

+1249
-546
lines changed

Some content is hidden

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

97 files changed

+1249
-546
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 7c64bf1b9b6e8e97ab652a4922f1c0e68ebc77f0
32+
refs/heads/stable: 8fc73c703ab175577346773ad93de3aa2c3f44a2
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ Some common make targets are:
131131
& everything builds in the correct manner.
132132
- `make check-stage1-std NO_REBUILD=1` - test the standard library without
133133
rebuilding the entire compiler
134-
- `make check TESTNAME=<path-to-test-file>.rs` - Run a single test file
135-
- `make check-stage1-rpass TESTNAME=<path-to-test-file>.rs` - Run a single
134+
- `make check TESTNAME=<substring-of-test-name>` - Run a matching set of tests.
135+
- `TESTNAME` should be a substring of the tests to match against e.g. it could
136+
be the fully qualified test name, or just a part of it.
137+
`TESTNAME=collections::hash::map::test_map::test_capacity_not_less_than_len`
138+
or `TESTNAME=test_capacity_not_less_than_len`.
139+
- `make check-stage1-rpass TESTNAME=<substring-of-test-name>` - Run a single
136140
rpass test with the stage1 compiler (this will be quicker than running the
137141
command above as we only build the stage1 compiler, not the entire thing).
138142
You can also leave off the `-rpass` to run all stage1 test types.

branches/stable/src/compiletest/util.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
3939
("msp430", "msp430"),
4040
("powerpc", "powerpc"),
4141
("powerpc64", "powerpc64"),
42-
("powerpc64le", "powerpc64le"),
4342
("s390x", "systemz"),
4443
("sparc", "sparc"),
4544
("x86_64", "x86_64"),

branches/stable/src/doc/book/documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ least. If your function has a non-trivial contract like this, that is
118118
detected/enforced by panics, documenting it is very important.
119119

120120
```rust
121-
/// # Failures
121+
/// # Errors
122122
# fn foo() {}
123123
```
124124

branches/stable/src/doc/book/error-handling.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,28 @@ fn file_name(file_path: &str) -> Option<&str> {
356356
```
357357

358358
You might think that we could use the `map` combinator to reduce the case
359-
analysis, but its type doesn't quite fit. Namely, `map` takes a function that
360-
does something only with the inner value. The result of that function is then
361-
*always* [rewrapped with `Some`](#code-option-map). Instead, we need something
362-
like `map`, but which allows the caller to return another `Option`. Its generic
363-
implementation is even simpler than `map`:
359+
analysis, but its type doesn't quite fit...
360+
361+
```rust,ignore
362+
fn file_path_ext(file_path: &str) -> Option<&str> {
363+
file_name(file_path).map(|x| extension(x)) //Compilation error
364+
}
365+
```
366+
367+
The `map` function here wraps the value returned by the `extension` function
368+
inside an `Option<_>` and since the `extension` function itself returns an
369+
`Option<&str>` the expression `file_name(file_path).map(|x| extension(x))`
370+
actually returns an `Option<Option<&str>>`.
371+
372+
But since `file_path_ext` just returns `Option<&str>` (and not
373+
`Option<Option<&str>>`) we get a compilation error.
374+
375+
The result of the function taken by map as input is *always* [rewrapped with
376+
`Some`](#code-option-map). Instead, we need something like `map`, but which
377+
allows the caller to return a `Option<_>` directly without wrapping it in
378+
another `Option<_>`.
379+
380+
Its generic implementation is even simpler than `map`:
364381

365382
```rust
366383
fn and_then<F, T, A>(option: Option<T>, f: F) -> Option<A>
@@ -382,6 +399,10 @@ fn file_path_ext(file_path: &str) -> Option<&str> {
382399
}
383400
```
384401

402+
Side note: Since `and_then` essentially works like `map` but returns an
403+
`Option<_>` instead of an `Option<Option<_>>` it is known as `flatmap` in some
404+
other languages.
405+
385406
The `Option` type has many other combinators [defined in the standard
386407
library][5]. It is a good idea to skim this list and familiarize
387408
yourself with what's available—they can often reduce case analysis

branches/stable/src/doc/book/getting-started.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Specifically they will each satisfy the following requirements:
3939

4040
| Target | std |rustc|cargo| notes |
4141
|-------------------------------|-----|-----|-----|----------------------------|
42+
| `i686-pc-windows-msvc` |||| 32-bit MSVC (Windows 7+) |
4243
| `x86_64-pc-windows-msvc` |||| 64-bit MSVC (Windows 7+) |
4344
| `i686-pc-windows-gnu` |||| 32-bit MinGW (Windows 7+) |
4445
| `x86_64-pc-windows-gnu` |||| 64-bit MinGW (Windows 7+) |
@@ -62,7 +63,6 @@ these platforms are required to have each of the following:
6263

6364
| Target | std |rustc|cargo| notes |
6465
|-------------------------------|-----|-----|-----|----------------------------|
65-
| `i686-pc-windows-msvc` |||| 32-bit MSVC (Windows 7+) |
6666
| `x86_64-unknown-linux-musl` || | | 64-bit Linux with MUSL |
6767
| `arm-linux-androideabi` || | | ARM Android |
6868
| `arm-unknown-linux-gnueabi` ||| | ARM Linux (2.6.18+) |
@@ -85,6 +85,9 @@ unofficial locations.
8585
| `i686-linux-android` || | | 32-bit x86 Android |
8686
| `aarch64-linux-android` || | | ARM64 Android |
8787
| `powerpc-unknown-linux-gnu` || | | PowerPC Linux (2.6.18+) |
88+
| `powerpc64-unknown-linux-gnu` || | | PPC64 Linux (2.6.18+) |
89+
|`powerpc64le-unknown-linux-gnu`|| | | PPC64LE Linux (2.6.18+) |
90+
|`armv7-unknown-linux-gnueabihf`|| | | ARMv7 Linux (2.6.18+) |
8891
| `i386-apple-ios` || | | 32-bit x86 iOS |
8992
| `x86_64-apple-ios` || | | 64-bit x86 iOS |
9093
| `armv7-apple-ios` || | | ARM iOS |
@@ -97,6 +100,7 @@ unofficial locations.
97100
| `x86_64-unknown-bitrig` ||| | 64-bit Bitrig |
98101
| `x86_64-unknown-dragonfly` ||| | 64-bit DragonFlyBSD |
99102
| `x86_64-rumprun-netbsd` || | | 64-bit NetBSD Rump Kernel |
103+
| `x86_64-sun-solaris` ||| | 64-bit Solaris/SunOS |
100104
| `i686-pc-windows-msvc` (XP) || | | Windows XP support |
101105
| `x86_64-pc-windows-msvc` (XP) || | | Windows XP support |
102106

@@ -569,7 +573,7 @@ executable application, as opposed to a library. Executables are often called
569573
*binaries* (as in `/usr/bin`, if you’re on a Unix system).
570574

571575
Cargo has generated two files and one directory for us: a `Cargo.toml` and a
572-
*src* directory with a *main.rs* file inside. These should look familliar,
576+
*src* directory with a *main.rs* file inside. These should look familiar,
573577
they’re exactly what we created by hand, above.
574578

575579
This output is all you need to get started. First, open `Cargo.toml`. It should

branches/stable/src/doc/book/guessing-game.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ it’s called on, and if it isn’t a successful one, [`panic!`][panic]s with a
276276
message you passed it. A `panic!` like this will cause our program to crash,
277277
displaying the message.
278278

279-
[expect]: ../std/option/enum.Option.html#method.expect
279+
[expect]: ../std/result/enum.Result.html#method.expect
280280
[panic]: error-handling.html
281281

282282
If we leave off calling this method, our program will compile, but

branches/stable/src/doc/book/loops.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ Don't forget to add the parentheses around the range.
125125
#### On iterators:
126126

127127
```rust
128-
# let lines = "hello\nworld".lines();
128+
let lines = "hello\nworld".lines();
129+
129130
for (linenumber, line) in lines.enumerate() {
130131
println!("{}: {}", linenumber, line);
131132
}
@@ -134,10 +135,8 @@ for (linenumber, line) in lines.enumerate() {
134135
Outputs:
135136

136137
```text
137-
0: Content of line one
138-
1: Content of line two
139-
2: Content of line three
140-
3: Content of line four
138+
0: hello
139+
1: world
141140
```
142141

143142
## Ending iteration early

branches/stable/src/doc/book/patterns.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,39 @@ let (x, _, z) = coordinate();
173173
Here, we bind the first and last element of the tuple to `x` and `z`, but
174174
ignore the middle element.
175175

176-
Similarly, you can use `..` in a pattern to disregard multiple values.
176+
It’s worth noting that using `_` never binds the value in the first place,
177+
which means a value may not move:
178+
179+
```rust
180+
let tuple: (u32, String) = (5, String::from("five"));
181+
182+
// Here, tuple is moved, because the String moved:
183+
let (x, _s) = tuple;
184+
185+
// The next line would give "error: use of partially moved value: `tuple`"
186+
// println!("Tuple is: {:?}", tuple);
187+
188+
// However,
189+
190+
let tuple = (5, String::from("five"));
191+
192+
// Here, tuple is _not_ moved, as the String was never moved, and u32 is Copy:
193+
let (x, _) = tuple;
194+
195+
// That means this works:
196+
println!("Tuple is: {:?}", tuple);
197+
```
198+
199+
This also means that any temporary variables will be dropped at the end of the
200+
statement:
201+
202+
```rust
203+
// Here, the String created will be dropped immediately, as it’s not bound:
204+
205+
let _ = String::from(" hello ").trim();
206+
```
207+
208+
You can also use `..` in a pattern to disregard multiple values:
177209

178210
```rust
179211
enum OptionalTuple {

branches/stable/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ The following configurations must be defined by the implementation:
20442044
production. For example, it controls the behavior of the standard library's
20452045
`debug_assert!` macro.
20462046
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"`
2047-
`"mips"`, `"powerpc"`, `"powerpc64"`, `"powerpc64le"`, `"arm"`, or `"aarch64"`.
2047+
`"mips"`, `"powerpc"`, `"powerpc64"`, `"arm"`, or `"aarch64"`.
20482048
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
20492049
`"big"`.
20502050
* `target_env = ".."` - An option provided by the compiler by default

branches/stable/src/etc/errorck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def check_unused_error_codes(error_codes, check_error_codes, filenames, dirnames
114114
if errcode in errcode_checked:
115115
continue
116116
all_errors.append(errcode)
117-
print("error: unused error code: " + errcode)
117+
print("error: unused error code: {0} ({1}:{2})".format(*errcode_map[errcode][0]))
118118
errors = True
119119

120120

branches/stable/src/liballoc_jemalloc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ extern "C" {
5151
// constant at the call site and the branch will be optimized out.
5252
#[cfg(all(any(target_arch = "arm",
5353
target_arch = "mips",
54-
target_arch = "mipsel",
5554
target_arch = "powerpc")))]
5655
const MIN_ALIGN: usize = 8;
5756
#[cfg(all(any(target_arch = "x86",

branches/stable/src/liballoc_system/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ extern crate libc;
2929
#[cfg(all(any(target_arch = "x86",
3030
target_arch = "arm",
3131
target_arch = "mips",
32-
target_arch = "mipsel",
3332
target_arch = "powerpc",
34-
target_arch = "powerpc64",
35-
target_arch = "powerpc64le")))]
33+
target_arch = "powerpc64")))]
3634
const MIN_ALIGN: usize = 8;
3735
#[cfg(all(any(target_arch = "x86_64",
3836
target_arch = "aarch64")))]

branches/stable/src/libcollections/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub struct IterMut<'a, T: 'a> {
8282
nelem: usize,
8383
}
8484

85-
/// An iterator over mutable references to the items of a `LinkedList`.
85+
/// An iterator over the items of a `LinkedList`.
8686
#[derive(Clone)]
8787
#[stable(feature = "rust1", since = "1.0.0")]
8888
pub struct IntoIter<T> {

branches/stable/src/libcollections/str.rs

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,13 @@ impl str {
15111511
/// 'Whitespace' is defined according to the terms of the Unicode Derived
15121512
/// Core Property `White_Space`.
15131513
///
1514+
/// # Text directionality
1515+
///
1516+
/// A string is a sequence of bytes. 'Left' in this context means the first
1517+
/// position of that byte string; for a language like Arabic or Hebrew
1518+
/// which are 'right to left' rather than 'left to right', this will be
1519+
/// the _right_ side, not the left.
1520+
///
15141521
/// # Examples
15151522
///
15161523
/// Basic usage:
@@ -1520,6 +1527,16 @@ impl str {
15201527
///
15211528
/// assert_eq!("Hello\tworld\t", s.trim_left());
15221529
/// ```
1530+
///
1531+
/// Directionality:
1532+
///
1533+
/// ```
1534+
/// let s = " English";
1535+
/// assert!(Some('E') == s.trim_left().chars().next());
1536+
///
1537+
/// let s = " עברית";
1538+
/// assert!(Some('ע') == s.trim_left().chars().next());
1539+
/// ```
15231540
#[stable(feature = "rust1", since = "1.0.0")]
15241541
pub fn trim_left(&self) -> &str {
15251542
UnicodeStr::trim_left(self)
@@ -1530,6 +1547,13 @@ impl str {
15301547
/// 'Whitespace' is defined according to the terms of the Unicode Derived
15311548
/// Core Property `White_Space`.
15321549
///
1550+
/// # Text directionality
1551+
///
1552+
/// A string is a sequence of bytes. 'Right' in this context means the last
1553+
/// position of that byte string; for a language like Arabic or Hebrew
1554+
/// which are 'right to left' rather than 'left to right', this will be
1555+
/// the _left_ side, not the right.
1556+
///
15331557
/// # Examples
15341558
///
15351559
/// Basic usage:
@@ -1539,6 +1563,16 @@ impl str {
15391563
///
15401564
/// assert_eq!(" Hello\tworld", s.trim_right());
15411565
/// ```
1566+
///
1567+
/// Directionality:
1568+
///
1569+
/// ```
1570+
/// let s = "English ";
1571+
/// assert!(Some('h') == s.trim_right().chars().rev().next());
1572+
///
1573+
/// let s = "עברית ";
1574+
/// assert!(Some('ת') == s.trim_right().chars().rev().next());
1575+
/// ```
15421576
#[stable(feature = "rust1", since = "1.0.0")]
15431577
pub fn trim_right(&self) -> &str {
15441578
UnicodeStr::trim_right(self)
@@ -1584,6 +1618,13 @@ impl str {
15841618
///
15851619
/// [`char`]: primitive.char.html
15861620
///
1621+
/// # Text directionality
1622+
///
1623+
/// A string is a sequence of bytes. 'Left' in this context means the first
1624+
/// position of that byte string; for a language like Arabic or Hebrew
1625+
/// which are 'right to left' rather than 'left to right', this will be
1626+
/// the _right_ side, not the left.
1627+
///
15871628
/// # Examples
15881629
///
15891630
/// Basic usage:
@@ -1608,6 +1649,13 @@ impl str {
16081649
///
16091650
/// [`char`]: primitive.char.html
16101651
///
1652+
/// # Text directionality
1653+
///
1654+
/// A string is a sequence of bytes. 'Right' in this context means the last
1655+
/// position of that byte string; for a language like Arabic or Hebrew
1656+
/// which are 'right to left' rather than 'left to right', this will be
1657+
/// the _left_ side, not the right.
1658+
///
16111659
/// # Examples
16121660
///
16131661
/// Simple patterns:
@@ -1644,7 +1692,7 @@ impl str {
16441692
///
16451693
/// [`FromStr`]: str/trait.FromStr.html
16461694
///
1647-
/// # Failure
1695+
/// # Errors
16481696
///
16491697
/// Will return `Err` if it's not possible to parse this string slice into
16501698
/// the desired type.

branches/stable/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ impl String {
433433
///
434434
/// [`str::from_utf8()`]: ../str/fn.from_utf8.html
435435
///
436-
/// # Failure
436+
/// # Errors
437437
///
438438
/// Returns `Err` if the slice is not UTF-8 with a description as to why the
439439
/// provided bytes are not UTF-8. The vector you moved in is also included.

branches/stable/src/libcollectionstest/btree/map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ fn test_clone() {
379379
}
380380

381381
#[test]
382+
#[allow(dead_code)]
382383
fn test_variance() {
383384
use std::collections::btree_map::{Iter, IntoIter, Range, Keys, Values};
384385

branches/stable/src/libcollectionstest/btree/set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ fn test_recovery() {
256256
}
257257

258258
#[test]
259+
#[allow(dead_code)]
259260
fn test_variance() {
260261
use std::collections::btree_set::{IntoIter, Iter, Range};
261262

0 commit comments

Comments
 (0)