Skip to content

Commit 0a7bc07

Browse files
committed
---
yaml --- r: 185343 b: refs/heads/master c: e5e76e9 h: refs/heads/master i: 185341: 356a830 185339: 32a6cc1 185335: 9422b7f 185327: 180caeb 185311: 30dc0da 185279: d724b1b 185215: 3e3825f 185087: 3469e2b 184831: eaa14c6 184319: ef184f9 v: v3
1 parent 84d9318 commit 0a7bc07

File tree

187 files changed

+1370
-2970
lines changed

Some content is hidden

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

187 files changed

+1370
-2970
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3ca54390095085eaae0baf85b0d1552067c5ee1b
2+
refs/heads/master: e5e76e9b968cc61012321d3a916e0315b58c4484
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77

trunk/README.md

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,28 @@ Read ["Installing Rust"] from [The Book].
1515
## Building from Source
1616

1717
1. Make sure you have installed the dependencies:
18-
19-
* `g++` 4.7 or `clang++` 3.x
20-
* `python` 2.6 or later (but not 3.x)
21-
* GNU `make` 3.81 or later
22-
* `curl`
23-
* `git`
18+
* `g++` 4.7 or `clang++` 3.x
19+
* `python` 2.6 or later (but not 3.x)
20+
* GNU `make` 3.81 or later
21+
* `curl`
22+
* `git`
2423

2524
2. Clone the [source] with `git`:
2625

27-
```sh
28-
$ git clone https://github.com/rust-lang/rust.git
29-
$ cd rust
30-
```
26+
$ git clone https://github.com/rust-lang/rust.git
27+
$ cd rust
3128

3229
[source]: https://github.com/rust-lang/rust
3330

3431
3. Build and install:
3532

36-
```sh
37-
$ ./configure
38-
$ make && make install
39-
```
33+
$ ./configure
34+
$ make && make install
4035

41-
> ***Note:*** You may need to use `sudo make install` if you do not
42-
> normally have permission to modify the destination directory. The
43-
> install locations can be adjusted by passing a `--prefix` argument
44-
> to `configure`. Various other options are also supported – pass
45-
> `--help` for more information on them.
36+
> ***Note:*** You may need to use `sudo make install` if you do not normally have
37+
> permission to modify the destination directory. The install locations can
38+
> be adjusted by passing a `--prefix` argument to `configure`. Various other
39+
> options are also supported, pass `--help` for more information on them.
4640
4741
When complete, `make install` will place several programs into
4842
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
@@ -53,30 +47,27 @@ Read ["Installing Rust"] from [The Book].
5347

5448
### Building on Windows
5549

56-
[MSYS2](http://msys2.github.io/) can be used to easily build Rust on Windows:
50+
To easily build on windows we can use [MSYS2](http://msys2.github.io/):
5751

5852
1. Grab the latest MSYS2 installer and go through the installer.
53+
2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
54+
tools we need.
5955

60-
2. From the MSYS2 terminal, install the `mingw64` toolchain and other required
61-
tools.
62-
63-
```sh
64-
# Choose one based on platform:
65-
$ pacman -S mingw-w64-i686-toolchain
66-
$ pacman -S mingw-w64-x86_64-toolchain
67-
68-
$ pacman -S base-devel
69-
```
56+
```bash
57+
# choose one based on platform
58+
$ pacman -S mingw-w64-i686-toolchain
59+
$ pacman -S mingw-w64-x86_64-toolchain
7060

71-
3. Run `mingw32_shell.bat` or `mingw64_shell.bat` from wherever you installed
72-
MYSY2 (i.e. `C:\msys`), depending on whether you want 32-bit or 64-bit Rust.
61+
$ pacman -S base-devel
62+
```
7363

74-
4. Navigate to Rust's source code, configure and build it:
64+
3. With that now start `mingw32_shell.bat` or `mingw64_shell.bat`
65+
from where you installed MSYS2 (i.e. `C:\msys`). Which one you
66+
choose depends on if you want 32 or 64 bit Rust.
67+
4. From there just navigate to where you have Rust's source code, configure and build it:
7568

76-
```sh
77-
$ ./configure
78-
$ make && make install
79-
```
69+
$ ./configure
70+
$ make && make install
8071

8172
## Notes
8273

@@ -101,15 +92,15 @@ There is more advice about hacking on Rust in [CONTRIBUTING.md].
10192

10293
[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
10394

104-
## Getting Help
95+
## Getting help
10596

10697
The Rust community congregates in a few places:
10798

108-
* [Stack Overflow] - Direct questions about using the language.
109-
* [users.rust-lang.org] - General discussion and broader questions.
99+
* [StackOverflow] - Direct questions about using the language here.
100+
* [users.rust-lang.org] - General discussion, broader questions.
110101
* [/r/rust] - News and general discussion.
111102

112-
[Stack Overflow]: http://stackoverflow.com/questions/tagged/rust
103+
[StackOverflow]: http://stackoverflow.com/questions/tagged/rust
113104
[/r/rust]: http://reddit.com/r/rust
114105
[users.rust-lang.org]: http://users.rust-lang.org/
115106

@@ -120,7 +111,7 @@ To contribute to Rust, please see [CONTRIBUTING.md](CONTRIBUTING.md).
120111
Rust has an [IRC] culture and most real-time collaboration happens in a
121112
variety of channels on Mozilla's IRC network, irc.mozilla.org. The
122113
most popular channel is [#rust], a venue for general discussion about
123-
Rust, and a good place to ask for help.
114+
Rust, and a good place to ask for help,
124115

125116
[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
126117
[#rust]: irc://irc.mozilla.org/rust

trunk/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
268268
logfile: config.logfile.clone(),
269269
run_tests: true,
270270
run_benchmarks: true,
271-
nocapture: env::var("RUST_TEST_NOCAPTURE").is_ok(),
271+
nocapture: false,
272272
color: test::AutoColor,
273273
}
274274
}

trunk/src/compiletest/header.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::env;
12-
1311
use common::Config;
1412
use common;
1513
use util;
@@ -127,16 +125,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
127125
true
128126
});
129127

130-
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_TASKS"] {
131-
match env::var(key) {
132-
Ok(val) =>
133-
if exec_env.iter().find(|&&(ref x, _)| *x == key.to_string()).is_none() {
134-
exec_env.push((key.to_string(), val))
135-
},
136-
Err(..) => {}
137-
}
138-
}
139-
140128
TestProps {
141129
error_patterns: error_patterns,
142130
compile_flags: compile_flags,

trunk/src/compiletest/runtest.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
8989
let proc_res = compile_test(config, props, testfile);
9090

9191
if proc_res.status.success() {
92-
fatal_proc_rec(&format!("{} test compiled successfully!", config.mode)[..],
92+
fatal_proc_rec(&format!("{} test compiled successfully!", config.mode)[],
9393
&proc_res);
9494
}
9595

@@ -398,7 +398,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
398398
for line in breakpoint_lines.iter() {
399399
script_str.push_str(&format!("break {:?}:{}\n",
400400
testfile.filename_display(),
401-
*line)[..]);
401+
*line)[]);
402402
}
403403
script_str.push_str(&cmds);
404404
script_str.push_str("quit\n");
@@ -553,17 +553,17 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
553553
script_str.push_str("set print pretty off\n");
554554

555555
// Add the pretty printer directory to GDB's source-file search path
556-
script_str.push_str(&format!("directory {}\n", rust_pp_module_abs_path)[..]);
556+
script_str.push_str(&format!("directory {}\n", rust_pp_module_abs_path)[]);
557557

558558
// Load the target executable
559559
script_str.push_str(&format!("file {}\n",
560-
exe_file.as_str().unwrap().replace("\\", "\\\\"))[..]);
560+
exe_file.as_str().unwrap().replace("\\", "\\\\"))[]);
561561

562562
// Add line breakpoints
563563
for line in &breakpoint_lines {
564564
script_str.push_str(&format!("break '{}':{}\n",
565565
testfile.filename_display(),
566-
*line)[..]);
566+
*line)[]);
567567
}
568568

569569
script_str.push_str(&cmds);
@@ -689,7 +689,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
689689
.unwrap()
690690
.to_string();
691691

692-
script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[..]);
692+
script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[]);
693693
script_str.push_str("type summary add --no-value ");
694694
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
695695
script_str.push_str("-x \".*\" --category Rust\n");

trunk/src/doc/intro.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -426,33 +426,39 @@ use std::thread::Thread;
426426
fn main() {
427427
let mut numbers = vec![1, 2, 3];
428428
429-
let guards: Vec<_> = (0..3).map(|i| {
430-
Thread::scoped(move || {
429+
for i in 0..3 {
430+
Thread::spawn(move || {
431431
for j in 0..3 { numbers[j] += 1 }
432432
});
433-
}).collect();
433+
}
434434
}
435435
```
436436
437437
It gives us this error:
438438
439439
```text
440-
7:29: 9:10 error: cannot move out of captured outer variable in an `FnMut` closure
441-
7 Thread::scoped(move || {
442-
8 for j in 0..3 { numbers[j] += 1 }
443-
9 });
440+
6:71 error: capture of moved value: `numbers`
441+
for j in 0..3 { numbers[j] += 1 }
442+
^~~~~~~
443+
7:50 note: `numbers` moved into closure environment here
444+
spawn(move || {
445+
for j in 0..3 { numbers[j] += 1 }
446+
});
447+
6:79 error: cannot assign to immutable dereference (dereference is implicit, due to indexing)
448+
for j in 0..3 { numbers[j] += 1 }
449+
^~~~~~~~~~~~~~~
444450
```
445451
446-
It mentions that "captured outer variable in an `FnMut` closure".
447-
Because we declared the closure as a moving closure, and it referred
448-
to `numbers`, the closure will try to take ownership of the
449-
vector. But the closure itself is created in a loop, and hence we will
450-
actually create three closures, one for every iteration of the
451-
loop. This means that all three of those closures would try to own
452-
`numbers`, which is impossible -- `numbers` must have just one
453-
owner. Rust detects this and gives us the error: we claim that
454-
`numbers` has ownership, but our code tries to make three owners. This
455-
may cause a safety problem, so Rust disallows it.
452+
It mentions that "numbers moved into closure environment". Because we
453+
declared the closure as a moving closure, and it referred to
454+
`numbers`, the closure will try to take ownership of the vector. But
455+
the closure itself is created in a loop, and hence we will actually
456+
create three closures, one for every iteration of the loop. This means
457+
that all three of those closures would try to own `numbers`, which is
458+
impossible -- `numbers` must have just one owner. Rust detects this
459+
and gives us the error: we claim that `numbers` has ownership, but our
460+
code tries to make three owners. This may cause a safety problem, so
461+
Rust disallows it.
456462
457463
What to do here? Rust has two types that helps us: `Arc<T>` and `Mutex<T>`.
458464
*Arc* stands for "atomically reference counted". In other words, an Arc will
@@ -474,14 +480,14 @@ use std::sync::{Arc,Mutex};
474480
fn main() {
475481
let numbers = Arc::new(Mutex::new(vec![1, 2, 3]));
476482
477-
let guards: Vec<_> = (0..3).map(|i| {
483+
for i in 0..3 {
478484
let number = numbers.clone();
479-
Thread::scoped(move || {
485+
Thread::spawn(move || {
480486
let mut array = number.lock().unwrap();
481487
array[i] += 1;
482488
println!("numbers[{}] is {}", i, array[i]);
483489
});
484-
}).collect();
490+
}
485491
}
486492
```
487493
@@ -510,10 +516,8 @@ numbers[1] is 3
510516
numbers[0] is 2
511517
```
512518
513-
Each time, we can get a slithtly different output because the threads
514-
are not quaranteed to run in any set order. If you get the same order
515-
every time it is because each of these threads are very small and
516-
complete too fast for their indeterminate behavior to surface.
519+
Each time, we get a slightly different output, because each thread works in a
520+
different order. You may not get the same output as this sample, even.
517521
518522
The important part here is that the Rust compiler was able to use ownership to
519523
give us assurance _at compile time_ that we weren't doing something incorrect
@@ -535,13 +539,13 @@ safety check that makes this an error about moved values:
535539
use std::thread::Thread;
536540
537541
fn main() {
538-
let numbers = vec![1, 2, 3];
539-
540-
let guards: Vec<_> = (0..3).map(|i| {
541-
Thread::scoped(move || {
542-
println!("{}", numbers[i]);
542+
let vec = vec![1, 2, 3];
543+
544+
for i in 0..3 {
545+
Thread::spawn(move || {
546+
println!("{}", vec[i]);
543547
});
544-
}).collect();
548+
}
545549
}
546550
```
547551

trunk/src/doc/reference.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,6 @@ This last example is different because it is not possible to use the suffix
515515
syntax with a floating point literal ending in a period. `2.f64` would attempt
516516
to call a method named `f64` on `2`.
517517

518-
The representation semantics of floating-point numbers are described in
519-
["Machine Types"](#machine-types).
520-
521518
#### Boolean literals
522519

523520
The two values of the boolean type are written `true` and `false`.
@@ -2165,7 +2162,7 @@ fn needs_foo_or_bar() {
21652162
21662163
// This function is only included when compiling for a unixish OS with a 32-bit
21672164
// architecture
2168-
#[cfg(all(unix, target_pointer_width = "32"))]
2165+
#[cfg(all(unix, target_word_size = "32"))]
21692166
fn on_32bit_unix() {
21702167
// ...
21712168
}
@@ -2193,9 +2190,9 @@ The following configurations must be defined by the implementation:
21932190
* `target_os = "..."`. Operating system of the target, examples include
21942191
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"`,
21952192
`"bitrig"` or `"openbsd"`.
2196-
* `target_pointer_width = "..."`. Target pointer width in bits. This is set
2197-
to `"32"` for targets with 32-bit pointers, and likewise set to `"64"` for
2198-
64-bit pointers.
2193+
* `target_word_size = "..."`. Target word size in bits. This is set to `"32"`
2194+
for targets with 32-bit pointers, and likewise set to `"64"` for 64-bit
2195+
pointers.
21992196
* `unix`. See `target_family`.
22002197
* `windows`. See `target_family`.
22012198

@@ -3557,8 +3554,7 @@ Tuple types and values are denoted by listing the types or values of their
35573554
elements, respectively, in a parenthesized, comma-separated list.
35583555

35593556
Because tuple elements don't have a name, they can only be accessed by
3560-
pattern-matching or by using `N` directly as a field to access the
3561-
`N`th element.
3557+
pattern-matching.
35623558

35633559
An example of a tuple type and its use:
35643560

@@ -3567,7 +3563,6 @@ type Pair<'a> = (i32, &'a str);
35673563
let p: Pair<'static> = (10, "hello");
35683564
let (a, b) = p;
35693565
assert!(b != "world");
3570-
assert!(p.0 == 10);
35713566
```
35723567

35733568
### Array, and Slice types

trunk/src/doc/rust.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
/* General structure */
5757

5858
body {
59-
background-color: white;
6059
margin: 0 auto;
6160
padding: 0 15px;
6261
font-family: "Source Serif Pro", Georgia, Times, "Times New Roman", serif;

trunk/src/doc/trpl/crates-and-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Rust has two distinct terms that relate to the module system: *crate* and
1212
*module*. A crate is synonymous with a *library* or *package* in other
1313
languages. Hence "Cargo" as the name of Rust's package management tool: you
1414
ship your crates to others with Cargo. Crates can produce an executable or a
15-
library, depending on the project.
15+
shared library, depending on the project.
1616

1717
Each crate has an implicit *root module* that contains the code for that crate.
1818
You can then define a tree of sub-modules under that root module. Modules allow

0 commit comments

Comments
 (0)