Skip to content

Commit b890bed

Browse files
committed
---
yaml --- r: 206419 b: refs/heads/beta c: db477ee h: refs/heads/master i: 206417: 9b60532 206415: 99680c0 v: v3
1 parent 765b68f commit b890bed

File tree

170 files changed

+1213
-2346
lines changed

Some content is hidden

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

170 files changed

+1213
-2346
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: 6cd748611346dec3181f81ca3aa551cce0529343
32+
refs/heads/beta: db477eef72924c7b34e9617627eaae37c71bdc1c
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/src/compiletest/compiletest.rs

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

branches/beta/src/doc/complement-lang-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ This does mean that indexed access to a Unicode codepoint inside a `str` value i
109109
* Most "character oriented" operations on text only work under very restricted language assumptions sets such as "ASCII-range codepoints only". Outside ASCII-range, you tend to have to use a complex (non-constant-time) algorithm for determining linguistic-unit (glyph, word, paragraph) boundaries anyways. We recommend using an "honest" linguistically-aware, Unicode-approved algorithm.
110110
* The `char` type is UCS4. If you honestly need to do a codepoint-at-a-time algorithm, it's trivial to write a `type wstr = [char]`, and unpack a `str` into it in a single pass, then work with the `wstr`. In other words: the fact that the language is not "decoding to UCS4 by default" shouldn't stop you from decoding (or re-encoding any other way) if you need to work with that encoding.
111111

112-
## Why are `str`s, slices, arrays etc. built-in types rather than (say) special kinds of trait/impl?
112+
## Why are strings, vectors etc. built-in types rather than (say) special kinds of trait/impl?
113113

114114
In each case there is one or more operator, literal constructor, overloaded use or integration with a built-in control structure that makes us think it would be awkward to phrase the type in terms of more-general type constructors. Same as, say, with numbers! But this is partly an aesthetic call, and we'd be willing to look at a worked-out proposal for eliminating or rephrasing these special cases.
115115

branches/beta/src/doc/reference.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,8 @@ warnings are generated, or otherwise "you used a private item of another module
15571557
and weren't allowed to."
15581558

15591559
By default, everything in Rust is *private*, with one exception. Enum variants
1560-
in a `pub` enum are also public by default. When an item is declared as `pub`,
1560+
in a `pub` enum are also public by default. You are allowed to alter this
1561+
default visibility with the `priv` keyword. When an item is declared as `pub`,
15611562
it can be thought of as being accessible to the outside world. For example:
15621563

15631564
```
@@ -2044,21 +2045,21 @@ A complete list of the built-in language items will be added in the future.
20442045

20452046
### Inline attributes
20462047

2047-
The inline attribute suggests that the compiler should place a copy of
2048-
the function or static in the caller, rather than generating code to
2049-
call the function or access the static where it is defined.
2048+
The inline attribute is used to suggest to the compiler to perform an inline
2049+
expansion and place a copy of the function or static in the caller rather than
2050+
generating code to call the function or access the static where it is defined.
20502051

20512052
The compiler automatically inlines functions based on internal heuristics.
2052-
Incorrectly inlining functions can actually make the program slower, so it
2053+
Incorrectly inlining functions can actually making the program slower, so it
20532054
should be used with care.
20542055

20552056
Immutable statics are always considered inlineable unless marked with
20562057
`#[inline(never)]`. It is undefined whether two different inlineable statics
20572058
have the same memory address. In other words, the compiler is free to collapse
20582059
duplicate inlineable statics together.
20592060

2060-
`#[inline]` and `#[inline(always)]` always cause the function to be serialized
2061-
into the crate metadata to allow cross-crate inlining.
2061+
`#[inline]` and `#[inline(always)]` always causes the function to be serialized
2062+
into crate metadata to allow cross-crate inlining.
20622063

20632064
There are three different types of inline attributes:
20642065

@@ -2425,18 +2426,11 @@ Tuples are written by enclosing zero or more comma-separated expressions in
24252426
parentheses. They are used to create [tuple-typed](#tuple-types) values.
24262427

24272428
```{.tuple}
2429+
(0,);
24282430
(0.0, 4.5);
24292431
("a", 4usize, true);
24302432
```
24312433

2432-
You can disambiguate a single-element tuple from a value in parentheses with a
2433-
comma:
2434-
2435-
```
2436-
(0,); // single-element tuple
2437-
(0); // zero in parentheses
2438-
```
2439-
24402434
### Unit expressions
24412435

24422436
The expression `()` denotes the _unit value_, the only value of the type with

branches/beta/src/doc/trpl/README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ want to dive in with a project, or ‘Syntax and Semantics’ if you prefer to
4040
start small, and learn a single concept thoroughly before moving onto the next.
4141
Copious cross-linking connects these parts together.
4242

43-
### Contributing
44-
45-
The source files from which this book is generated can be found on Github:
46-
[github.com/rust-lang/rust/tree/master/src/doc/trpl](https://github.com/rust-lang/rust/tree/master/src/doc/trpl)
47-
4843
## A brief introduction to Rust
4944

5045
Is Rust a language you might be interested in? Let’s examine a few small code
@@ -195,5 +190,5 @@ fn main() {
195190
We created an inner scope with an additional set of curly braces. `y` will go out of
196191
scope before we call `push()`, and so we’re all good.
197192

198-
This concept of ownership isn’t just good for preventing dangling pointers, but an
193+
This concept of ownership isn’t just good for preventing danging pointers, but an
199194
entire set of related problems, like iterator invalidation, concurrency, and more.

branches/beta/src/doc/trpl/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,5 @@
6464
* [Benchmark Tests](benchmark-tests.md)
6565
* [Box Syntax and Patterns](box-syntax-and-patterns.md)
6666
* [Slice Patterns](slice-patterns.md)
67-
* [Associated Constants](associated-constants.md)
6867
* [Glossary](glossary.md)
6968
* [Academic Research](academic-research.md)

branches/beta/src/doc/trpl/associated-constants.md

Lines changed: 0 additions & 79 deletions
This file was deleted.

branches/beta/src/doc/trpl/attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list
6767
of attributes [in the reference][reference]. Currently, you are not allowed to
6868
create your own attributes, the Rust compiler defines them.
6969

70-
[reference]: ../reference.html#attributes
70+
[reference]: reference.html#attributes

branches/beta/src/doc/trpl/concurrency.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ use std::thread;
116116
fn main() {
117117
let mut data = vec![1u32, 2, 3];
118118
119-
for i in 0..3 {
119+
for i in 0..2 {
120120
thread::spawn(move || {
121121
data[i] += 1;
122122
});
@@ -154,7 +154,7 @@ use std::sync::Mutex;
154154
fn main() {
155155
let mut data = Mutex::new(vec![1u32, 2, 3]);
156156
157-
for i in 0..3 {
157+
for i in 0..2 {
158158
let data = data.lock().unwrap();
159159
thread::spawn(move || {
160160
data[i] += 1;
@@ -196,7 +196,7 @@ use std::thread;
196196
fn main() {
197197
let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
198198
199-
for i in 0..3 {
199+
for i in 0..2 {
200200
let data = data.clone();
201201
thread::spawn(move || {
202202
let mut data = data.lock().unwrap();
@@ -217,7 +217,7 @@ thread more closely:
217217
# use std::thread;
218218
# fn main() {
219219
# let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
220-
# for i in 0..3 {
220+
# for i in 0..2 {
221221
# let data = data.clone();
222222
thread::spawn(move || {
223223
let mut data = data.lock().unwrap();

branches/beta/src/doc/trpl/const-and-static.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ this reason.
1919
# `static`
2020

2121
Rust provides a ‘global variable’ sort of facility in static items. They’re
22-
similar to constants, but static items aren’t inlined upon use. This means that
23-
there is only one instance for each value, and it’s at a fixed location in
24-
memory.
22+
similar to [constants][const], but static items aren’t inlined upon use. This
23+
means that there is only one instance for each value, and it’s at a fixed
24+
location in memory.
2525

2626
Here’s an example:
2727

2828
```rust
2929
static N: i32 = 5;
3030
```
3131

32+
[const]: const.html
33+
3234
Unlike [`let`][let] bindings, you must annotate the type of a `static`.
3335

3436
[let]: variable-bindings.html

branches/beta/src/doc/trpl/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ struct Info {
252252
}
253253

254254
fn write_info(info: &Info) -> io::Result<()> {
255-
let mut file = File::create("my_best_friends.txt").unwrap();
255+
let mut file = File::open("my_best_friends.txt").unwrap();
256256

257257
if let Err(e) = writeln!(&mut file, "name: {}", info.name) {
258258
return Err(e)
@@ -282,7 +282,7 @@ struct Info {
282282
}
283283

284284
fn write_info(info: &Info) -> io::Result<()> {
285-
let mut file = try!(File::create("my_best_friends.txt"));
285+
let mut file = try!(File::open("my_best_friends.txt"));
286286

287287
try!(writeln!(&mut file, "name: {}", info.name));
288288
try!(writeln!(&mut file, "age: {}", info.age));

branches/beta/src/doc/trpl/hello-cargo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ projects. Cargo is currently in a pre-1.0 state, and so it is still a work in
55
progress. However, it is already good enough to use for many Rust projects, and
66
so it is assumed that Rust projects will use Cargo from the beginning.
77

8-
[cratesio]: http://doc.crates.io
8+
[cratesio]: https://doc.crates.io
99

1010
Cargo manages three things: building your code, downloading the dependencies
1111
your code needs, and building those dependencies. At first, your

branches/beta/src/doc/trpl/installing-rust.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ or a Mac, all you need to do is this (note that you don't need to type in the
66
`$`s, they just indicate the start of each command):
77

88
```bash
9-
$ curl -sf -L https://static.rust-lang.org/rustup.sh | sh
9+
$ curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh
1010
```
1111

1212
If you're concerned about the [potential insecurity][insecurity] of using `curl
13-
| sh`, please keep reading and see our disclaimer below. And feel free to
13+
| sudo sh`, please keep reading and see our disclaimer below. And feel free to
1414
use a two-step version of the installation and examine our installation script:
1515

1616
```bash
1717
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
18-
$ sh rustup.sh
18+
$ sudo sh rustup.sh
1919
```
2020

2121
[insecurity]: http://curlpipesh.tumblr.com
@@ -40,11 +40,13 @@ If you used the Windows installer, just re-run the `.msi` and it will give you
4040
an uninstall option.
4141

4242
Some people, and somewhat rightfully so, get very upset when we tell you to
43-
`curl | sh`. Basically, when you do this, you are trusting that the good
43+
`curl | sudo sh`. Basically, when you do this, you are trusting that the good
4444
people who maintain Rust aren't going to hack your computer and do bad things.
4545
That's a good instinct! If you're one of those people, please check out the
4646
documentation on [building Rust from Source][from source], or [the official
47-
binary downloads][install page].
47+
binary downloads][install page]. And we promise that this method will not be
48+
the way to install Rust forever: it's just the easiest way to keep people
49+
updated while Rust is in its alpha state.
4850

4951
[from source]: https://github.com/rust-lang/rust#building-from-source
5052
[install page]: http://www.rust-lang.org/install.html

branches/beta/src/doc/trpl/iterators.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,26 @@ Ranges are one of two basic iterators that you'll see. The other is `iter()`.
235235
in turn:
236236

237237
```rust
238-
let nums = vec![1, 2, 3];
238+
let nums = [1, 2, 3];
239239

240240
for num in nums.iter() {
241241
println!("{}", num);
242242
}
243243
```
244244

245245
These two basic iterators should serve you well. There are some more
246-
advanced iterators, including ones that are infinite.
246+
advanced iterators, including ones that are infinite. Like using range syntax
247+
and `step_by`:
248+
249+
```rust
250+
# #![feature(step_by)]
251+
(1..).step_by(5);
252+
```
253+
254+
This iterator counts up from one, adding five each time. It will give
255+
you a new integer every time, forever (well, technically, until it reaches the
256+
maximum number representable by an `i32`). But since iterators are lazy,
257+
that's okay! You probably don't want to use `collect()` on it, though...
247258

248259
That's enough about iterators. Iterator adapters are the last concept
249260
we need to talk about with regards to iterators. Let's get to it!

branches/beta/src/doc/trpl/nightly-rust.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ process, see ‘[Stability as a deliverable][stability]’.
99
To install nightly Rust, you can use `rustup.sh`:
1010

1111
```bash
12-
$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
12+
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
1313
```
1414

1515
If you're concerned about the [potential insecurity][insecurity] of using `curl
16-
| sh`, please keep reading and see our disclaimer below. And feel free to
16+
| sudo sh`, please keep reading and see our disclaimer below. And feel free to
1717
use a two-step version of the installation and examine our installation script:
1818

1919
```bash
2020
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
21-
$ sh rustup.sh --channel=nightly
21+
$ sudo sh rustup.sh --channel=nightly
2222
```
2323

2424
[insecurity]: http://curlpipesh.tumblr.com
@@ -43,11 +43,13 @@ If you used the Windows installer, just re-run the `.msi` and it will give you
4343
an uninstall option.
4444

4545
Some people, and somewhat rightfully so, get very upset when we tell you to
46-
`curl | sh`. Basically, when you do this, you are trusting that the good
46+
`curl | sudo sh`. Basically, when you do this, you are trusting that the good
4747
people who maintain Rust aren't going to hack your computer and do bad things.
4848
That's a good instinct! If you're one of those people, please check out the
4949
documentation on [building Rust from Source][from source], or [the official
50-
binary downloads][install page].
50+
binary downloads][install page]. And we promise that this method will not be
51+
the way to install Rust forever: it's just the easiest way to keep people
52+
updated while Rust is in its alpha state.
5153

5254
[from source]: https://github.com/rust-lang/rust#building-from-source
5355
[install page]: http://www.rust-lang.org/install.html
@@ -91,7 +93,8 @@ If not, there are a number of places where you can get help. The easiest is
9193
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
9294
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
9395
(a silly nickname we call ourselves), and we can help you out. Other great
94-
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
96+
resources include [the user’s forum][users], and [Stack Overflow][stack
97+
overflow].
9598

9699
[irc]: irc://irc.mozilla.org/#rust
97100
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust

0 commit comments

Comments
 (0)