Skip to content

Commit 136bc19

Browse files
committed
---
yaml --- r: 206773 b: refs/heads/beta c: d13f765 h: refs/heads/master i: 206771: a76dc25 v: v3
1 parent d8e9ea0 commit 136bc19

39 files changed

+514
-1504
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: bb15c4762dc6eceb8e34a521e0e6ab627066f314
32+
refs/heads/beta: d13f765be8d202450bf106057e19d6bd57f51f6c
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/src/doc/index.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ to jump to any particular section.
55

66
# Getting Started
77

8-
If you haven't seen Rust at all yet, the first thing you should read is the
9-
introduction to [The Rust Programming Language](book/index.html). It'll give
10-
you a good idea of what Rust is like.
11-
12-
The book provides a lengthy explanation of Rust, its syntax, and its
13-
concepts. Upon completing the book, you'll be an intermediate Rust
14-
developer, and will have a good grasp of the fundamental ideas behind
15-
Rust.
8+
If you haven't seen Rust at all yet, the first thing you should read is the [30
9+
minute intro](intro.html). It will give you an overview of the basic ideas of Rust
10+
at a high level.
11+
12+
Once you know you really want to learn Rust, the next step is reading [The
13+
Rust Programming Language](book/index.html). It is a lengthy explanation of
14+
Rust, its syntax, and its concepts. Upon completing the book, you'll be an
15+
intermediate Rust developer, and will have a good grasp of the fundamental
16+
ideas behind Rust.
1617

1718
[Rust By Example][rbe] was originally a community resource, but was then
1819
donated to the Rust project. As the name implies, it teaches you Rust through a

branches/beta/src/doc/reference.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,23 @@ You may also be interested in the [grammar].
3131

3232
## Unicode productions
3333

34-
A few productions in Rust's grammar permit Unicode code points outside the
35-
ASCII range. We define these productions in terms of character properties
36-
specified in the Unicode standard, rather than in terms of ASCII-range code
37-
points. The grammar has a [Special Unicode Productions][unicodeproductions]
38-
section that lists these productions.
39-
40-
[unicodeproductions]: grammar.html#special-unicode-productions
34+
A few productions in Rust's grammar permit Unicode code points outside the ASCII
35+
range. We define these productions in terms of character properties specified
36+
in the Unicode standard, rather than in terms of ASCII-range code points. The
37+
section [Special Unicode Productions](#special-unicode-productions) lists these
38+
productions.
4139

4240
## String table productions
4341

4442
Some rules in the grammar — notably [unary
4543
operators](#unary-operator-expressions), [binary
46-
operators](#binary-operator-expressions), and [keywords][keywords] — are
44+
operators](#binary-operator-expressions), and [keywords](#keywords) — are
4745
given in a simplified form: as a listing of a table of unquoted, printable
4846
whitespace-separated strings. These cases form a subset of the rules regarding
4947
the [token](#tokens) rule, and are assumed to be the result of a
5048
lexical-analysis phase feeding the parser, driven by a DFA, operating over the
5149
disjunction of all such string table entries.
5250

53-
[keywords]: grammar.html#keywords
54-
5551
When such a string enclosed in double-quotes (`"`) occurs inside the grammar,
5652
it is an implicit reference to a single member of such a string table
5753
production. See [tokens](#tokens) for more information.
@@ -79,7 +75,7 @@ An identifier is any nonempty Unicode[^non_ascii_idents] string of the following
7975
- The first character has property `XID_start`
8076
- The remaining characters have property `XID_continue`
8177

82-
that does _not_ occur in the set of [keywords][keywords].
78+
that does _not_ occur in the set of [keywords](#keywords).
8379

8480
> **Note**: `XID_start` and `XID_continue` as character properties cover the
8581
> character ranges used to form the more familiar C and Java language-family
@@ -405,7 +401,7 @@ Symbols are a general class of printable [token](#tokens) that play structural
405401
roles in a variety of grammar productions. They are catalogued here for
406402
completeness as the set of remaining miscellaneous printable tokens that do not
407403
otherwise appear as [unary operators](#unary-operator-expressions), [binary
408-
operators](#binary-operator-expressions), or [keywords][keywords].
404+
operators](#binary-operator-expressions), or [keywords](#keywords).
409405

410406

411407
## Paths
@@ -551,7 +547,7 @@ _name_ s that occur in its body. At the "current layer", they all must repeat
551547
the same number of times, so ` ( $( $i:ident ),* ; $( $j:ident ),* ) => ( $(
552548
($i,$j) ),* )` is valid if given the argument `(a,b,c ; d,e,f)`, but not
553549
`(a,b,c ; d,e)`. The repetition walks through the choices at that layer in
554-
lockstep, so the former input transcribes to `(a,d), (b,e), (c,f)`.
550+
lockstep, so the former input transcribes to `( (a,d), (b,e), (c,f) )`.
555551

556552
Nested repetitions are allowed.
557553

@@ -615,7 +611,7 @@ module needs its own source file: [module definitions](#modules) can be nested
615611
within one file.
616612

617613
Each source file contains a sequence of zero or more `item` definitions, and
618-
may optionally begin with any number of [attributes](#items-and-attributes)
614+
may optionally begin with any number of [attributes](#Items and attributes)
619615
that apply to the containing module, most of which influence the behavior of
620616
the compiler. The anonymous crate module can have additional attributes that
621617
apply to the crate as a whole.
@@ -657,7 +653,7 @@ There are several kinds of item:
657653
* [`use` declarations](#use-declarations)
658654
* [modules](#modules)
659655
* [functions](#functions)
660-
* [type definitions](grammar.html#type-definitions)
656+
* [type aliases](#type-aliases)
661657
* [structures](#structures)
662658
* [enumerations](#enumerations)
663659
* [constant items](#constant-items)
@@ -777,7 +773,7 @@ extern crate std as ruststd; // linking to 'std' under another name
777773
A _use declaration_ creates one or more local name bindings synonymous with
778774
some other [path](#paths). Usually a `use` declaration is used to shorten the
779775
path required to refer to a module item. These declarations may appear at the
780-
top of [modules](#modules) and [blocks](grammar.html#block-expressions).
776+
top of [modules](#modules) and [blocks](#blocks).
781777

782778
> **Note**: Unlike in many languages,
783779
> `use` declarations in Rust do *not* declare linkage dependency with external crates.
@@ -1148,7 +1144,9 @@ let px: i32 = match p { Point(x, _) => x };
11481144
```
11491145

11501146
A _unit-like struct_ is a structure without any fields, defined by leaving off
1151-
the list of fields entirely. Such types will have a single value. For example:
1147+
the list of fields entirely. Such types will have a single value, just like
1148+
the [unit value `()`](#unit-and-boolean-literals) of the unit type. For
1149+
example:
11521150

11531151
```
11541152
struct Cookie;
@@ -2438,6 +2436,11 @@ comma:
24382436
(0); // zero in parentheses
24392437
```
24402438

2439+
### Unit expressions
2440+
2441+
The expression `()` denotes the _unit value_, the only value of the type with
2442+
the same name.
2443+
24412444
### Structure expressions
24422445

24432446
There are several forms of structure expressions. A _structure expression_
@@ -3278,7 +3281,7 @@ constructor or `struct` field may refer, directly or indirectly, to the
32783281
enclosing `enum` or `struct` type itself. Such recursion has restrictions:
32793282

32803283
* Recursive types must include a nominal type in the recursion
3281-
(not mere [type definitions](grammar.html#type-definitions),
3284+
(not mere [type definitions](#type-definitions),
32823285
or other structural types such as [arrays](#array,-and-slice-types) or [tuples](#tuple-types)).
32833286
* A recursive `enum` item must have at least one non-recursive constructor
32843287
(in order to give the recursion a basis case).

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* [Concurrency](concurrency.md)
1616
* [Error Handling](error-handling.md)
1717
* [FFI](ffi.md)
18-
* [Borrow and AsRef](borrow-and-asref.md)
1918
* [Syntax and Semantics](syntax-and-semantics.md)
2019
* [Variable Bindings](variable-bindings.md)
2120
* [Functions](functions.md)

branches/beta/src/doc/trpl/borrow-and-asref.md

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

branches/beta/src/doc/trpl/compiler-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ for a full example, the core of which is reproduced here:
176176

177177
```ignore
178178
declare_lint!(TEST_LINT, Warn,
179-
"Warn about items named 'lintme'");
179+
"Warn about items named 'lintme'")
180180
181181
struct Pass;
182182

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Rust’s most unique and compelling features, with which Rust developers should
55
become quite acquainted. Ownership is how Rust achieves its largest goal,
66
memory safety. There are a few distinct concepts, each with its own chapter:
77

8-
* [ownership][ownership], the key concept
8+
* [ownership][ownership], ownership, the key concept
99
* [borrowing][borrowing], and their associated feature ‘references’
1010
* lifetimes, which you’re reading now
1111

branches/beta/src/doc/trpl/method-syntax.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ fn grow(&self) -> Circle {
127127
We just say we’re returning a `Circle`. With this method, we can grow a new
128128
circle to any arbitrary size.
129129

130-
# Associated functions
130+
# Static methods
131131

132-
You can also define associated functions that do not take a `self` parameter.
133-
Here’s a pattern that’s very common in Rust code:
132+
You can also define static methods that do not take a `self` parameter. Here’s a
133+
pattern that’s very common in Rust code:
134134

135-
```rust
135+
```
136136
struct Circle {
137137
x: f64,
138138
y: f64,

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ become quite acquainted. Ownership is how Rust achieves its largest goal,
66
memory safety. There are a few distinct concepts, each with its own
77
chapter:
88

9-
* ownership, which you’re reading now
9+
* ownership, which you’re reading now.
1010
* [borrowing][borrowing], and their associated feature ‘references’
1111
* [lifetimes][lifetimes], an advanced concept of borrowing
1212

@@ -23,7 +23,7 @@ Before we get to the details, two important notes about the ownership system.
2323
Rust has a focus on safety and speed. It accomplishes these goals through many
2424
‘zero-cost abstractions’, which means that in Rust, abstractions cost as little
2525
as possible in order to make them work. The ownership system is a prime example
26-
of a zero-cost abstraction. All of the analysis we’ll talk about in this guide
26+
of a zero cost abstraction. All of the analysis we’ll talk about in this guide
2727
is _done at compile time_. You do not pay any run-time cost for any of these
2828
features.
2929

@@ -41,7 +41,7 @@ With that in mind, let’s learn about ownership.
4141

4242
# Ownership
4343

44-
[Variable bindings][bindings] have a property in Rust: they ‘have ownership’
44+
[`Variable bindings`][bindings] have a property in Rust: they ‘have ownership’
4545
of what they’re bound to. This means that when a binding goes out of scope, the
4646
resource that they’re bound to are freed. For example:
4747

@@ -106,8 +106,8 @@ take(v);
106106
println!("v[0] is: {}", v[0]);
107107
```
108108

109-
Same error: use of moved value’. When we transfer ownership to something else,
110-
we say that we’ve ‘moved’ the thing we refer to. You don’t need any sort of
109+
Same error: use of moved value.” When we transfer ownership to something else,
110+
we say that we’ve ‘moved’ the thing we refer to. You don’t need some sort of
111111
special annotation here, it’s the default thing that Rust does.
112112

113113
## The details
@@ -121,19 +121,19 @@ let v = vec![1, 2, 3];
121121
let v2 = v;
122122
```
123123

124-
The first line allocates memory for the vector object, `v`, and for the data it
125-
contains. The vector object is stored on the [stack][sh] and contains a pointer
126-
to the content (`[1, 2, 3]`) stored on the [heap][sh]. When we move `v` to `v2`,
127-
it creates a copy of that pointer, for `v2`. Which means that there would be two
128-
pointers to the content of the vector on the heap. It would violate Rust’s
129-
safety guarantees by introducing a data race. Therefore, Rust forbids using `v`
130-
after we’ve done the move.
124+
The first line creates some data for the vector on the [stack][sh], `v`. The
125+
vector’s data, however, is stored on the [heap][sh], and so it contains a
126+
pointer to that data. When we move `v` to `v2`, it creates a copy of that pointer,
127+
for `v2`. Which would mean two pointers to the contents of the vector on the
128+
heap. That would be a problem: it would violate Rust’s safety guarantees by
129+
introducing a data race. Therefore, Rust forbids using `v` after we’ve done the
130+
move.
131131

132132
[sh]: the-stack-and-the-heap.html
133133

134134
It’s also important to note that optimizations may remove the actual copy of
135-
the bytes on the stack, depending on circumstances. So it may not be as
136-
inefficient as it initially seems.
135+
the bytes, depending on circumstances. So it may not be as inefficient as it
136+
initially seems.
137137

138138
## `Copy` types
139139

branches/beta/src/doc/trpl/primitive-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let x = true;
1515
let y: bool = false;
1616
```
1717

18-
A common use of booleans is in [`if` statements][if].
18+
A common use of booleans is in [`if` conditionals][if].
1919

2020
[if]: if.html
2121

0 commit comments

Comments
 (0)