Skip to content

Commit 621b622

Browse files
committed
---
yaml --- r: 172750 b: refs/heads/try c: a09b139 h: refs/heads/master v: v3
1 parent 85f1233 commit 621b622

Some content is hidden

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

60 files changed

+337
-359
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 170c4399e614fe599c3d41306b3429ca8b3b68c6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: ccb1e460dc6f9807a36a4a1f941ec6e4ac1a7ed5
5+
refs/heads/try: a09b139f9c4c6f4a2c3fb78e906e3ae0abf7f901
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/mk/docs.mk

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ DOCS := index intro tutorial complement-bugreport \
2929
complement-lang-faq complement-design-faq complement-project-faq \
3030
rustdoc reference
3131

32+
# Legacy guides, preserved for a while to reduce the number of 404s
33+
DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
34+
guide-ownership guide-plugins guide-pointers guide-strings guide-tasks \
35+
guide-testing
36+
37+
3238
PDF_DOCS := reference
3339

3440
RUSTDOC_DEPS_reference := doc/full-toc.inc
@@ -277,6 +283,6 @@ compiler-docs: $(COMPILER_DOC_TARGETS)
277283

278284
trpl: doc/book/index.html
279285

280-
doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/trpl/*.md)
286+
doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/trpl/*.md) | doc/
281287
$(Q)rm -rf doc/book
282288
$(Q)$(RUSTBOOK) build $(S)src/doc/trpl doc/book

branches/try/src/doc/guide-crates.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Crates and Modules Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/crates-and-modules.html).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% Error Handling in Rust
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/error-handling.html).

branches/try/src/doc/guide-ffi.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Foreign Function Interface Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/ffi.html).

branches/try/src/doc/guide-macros.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Macros Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/macros.html).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Ownership Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/ownership.html).

branches/try/src/doc/guide-plugins.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Compiler Plugins Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/plugins.html).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Pointer Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/pointers.html).

branches/try/src/doc/guide-strings.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Guide to Rust Strings
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/strings.html).

branches/try/src/doc/guide-tasks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Threads and Communication Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/tasks.html).

branches/try/src/doc/guide-testing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Testing Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/testing.html).

branches/try/src/doc/guide-unsafe.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% Writing Safe Low-level and Unsafe Code in Rust
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/unsafe.html).

branches/try/src/doc/guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
% The (old) Rust Guide
2+
3+
This content has moved into the
4+
[the Rust Programming Language book](book/README.html).

branches/try/src/doc/trpl/arrays-vectors-and-slices.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Arrays, Vectors, and Slices
22

33
Like many programming languages, Rust has list types to represent a sequence of
4-
things. The most basic is the **array**, a fixed-size list of elements of the
4+
things. The most basic is the *array*, a fixed-size list of elements of the
55
same type. By default, arrays are immutable.
66

77
```{rust}
@@ -32,7 +32,7 @@ for e in a.iter() {
3232
}
3333
```
3434

35-
You can access a particular element of an array with **subscript notation**:
35+
You can access a particular element of an array with *subscript notation*:
3636

3737
```{rust}
3838
let names = ["Graydon", "Brian", "Niko"]; // names: [&str; 3]
@@ -47,7 +47,7 @@ array, you will get an error: array access is bounds-checked at run-time. Such
4747
errant access is the source of many bugs in other systems programming
4848
languages.
4949

50-
A **vector** is a dynamic or "growable" array, implemented as the standard
50+
A *vector* is a dynamic or "growable" array, implemented as the standard
5151
library type [`Vec<T>`](../std/vec/) (we'll talk about what the `<T>` means
5252
later). Vectors are to arrays what `String` is to `&str`. You can create them
5353
with the `vec!` macro:
@@ -73,7 +73,7 @@ println!("The length of nums is now {}", nums.len()); // Prints 4
7373

7474
Vectors have many more useful methods.
7575

76-
A **slice** is a reference to (or "view" into) an array. They are useful for
76+
A *slice* is a reference to (or "view" into) an array. They are useful for
7777
allowing safe, efficient access to a portion of an array without copying. For
7878
example, you might want to reference just one line of a file read into memory.
7979
By nature, a slice is not created directly, but from an existing variable.

branches/try/src/doc/trpl/closures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
So far, we've made lots of functions in Rust, but we've given them all names.
44
Rust also allows us to create anonymous functions. Rust's anonymous
5-
functions are called **closure**s. By themselves, closures aren't all that
5+
functions are called *closures*. By themselves, closures aren't all that
66
interesting, but when you combine them with functions that take closures as
77
arguments, really powerful things are possible.
88

@@ -61,7 +61,7 @@ fn main() {
6161

6262
## Moving closures
6363

64-
Rust has a second type of closure, called a **moving closure**. Moving
64+
Rust has a second type of closure, called a *moving closure*. Moving
6565
closures are indicated using the `move` keyword (e.g., `move || x *
6666
x`). The difference between a moving closure and an ordinary closure
6767
is that a moving closure always takes ownership of all variables that

branches/try/src/doc/trpl/comments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Now that we have some functions, it's a good idea to learn about comments.
44
Comments are notes that you leave to other programmers to help explain things
55
about your code. The compiler mostly ignores them.
66

7-
Rust has two kinds of comments that you should care about: **line comment**s
8-
and **doc comment**s.
7+
Rust has two kinds of comments that you should care about: *line comments*
8+
and *doc comments*.
99

1010
```{rust}
1111
// Line comments are anything after '//' and extend to the end of the line.

branches/try/src/doc/trpl/compound-data-types.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ strings, but next, let's talk about some more complicated ways of storing data.
66

77
## Tuples
88

9-
The first compound data type we're going to talk about are called **tuple**s.
9+
The first compound data type we're going to talk about are called *tuples*.
1010
Tuples are an ordered list of a fixed size. Like this:
1111

1212
```rust
@@ -25,10 +25,10 @@ position having a type name rather than the value. Careful readers will also
2525
note that tuples are heterogeneous: we have an `i32` and a `&str` in this tuple.
2626
You haven't seen `&str` as a type before, and we'll discuss the details of
2727
strings later. In systems programming languages, strings are a bit more complex
28-
than in other languages. For now, just read `&str` as "a string slice," and
28+
than in other languages. For now, just read `&str` as a *string slice*, and
2929
we'll learn more soon.
3030

31-
You can access the fields in a tuple through a **destructuring let**. Here's
31+
You can access the fields in a tuple through a *destructuring let*. Here's
3232
an example:
3333

3434
```rust
@@ -40,8 +40,8 @@ println!("x is {}", x);
4040
Remember before when I said the left-hand side of a `let` statement was more
4141
powerful than just assigning a binding? Here we are. We can put a pattern on
4242
the left-hand side of the `let`, and if it matches up to the right-hand side,
43-
we can assign multiple bindings at once. In this case, `let` 'destructures,'
44-
or 'breaks up,' the tuple, and assigns the bits to three bindings.
43+
we can assign multiple bindings at once. In this case, `let` "destructures,"
44+
or "breaks up," the tuple, and assigns the bits to three bindings.
4545

4646
This pattern is very powerful, and we'll see it repeated more later.
4747

@@ -83,18 +83,18 @@ fn main() {
8383
}
8484
```
8585

86-
Even though Rust functions can only return one value, a tuple _is_ one value,
87-
that happens to be made up of more than one value. You can also see in this example how you
88-
can destructure a pattern returned by a function, as well.
86+
Even though Rust functions can only return one value, a tuple *is* one value,
87+
that happens to be made up of more than one value. You can also see in this
88+
example how you can destructure a pattern returned by a function, as well.
8989

9090
Tuples are a very simple data structure, and so are not often what you want.
9191
Let's move on to their bigger sibling, structs.
9292

9393
## Structs
9494

95-
A struct is another form of a 'record type,' just like a tuple. There's a
95+
A struct is another form of a *record type*, just like a tuple. There's a
9696
difference: structs give each element that they contain a name, called a
97-
'field' or a 'member.' Check it out:
97+
*field* or a *member*. Check it out:
9898

9999
```rust
100100
struct Point {
@@ -143,8 +143,7 @@ This will print `The point is at (5, 0)`.
143143
## Tuple Structs and Newtypes
144144

145145
Rust has another data type that's like a hybrid between a tuple and a struct,
146-
called a **tuple struct**. Tuple structs do have a name, but their fields
147-
don't:
146+
called a *tuple struct*. Tuple structs do have a name, but their fields don't:
148147

149148

150149
```{rust}
@@ -182,7 +181,7 @@ Now, we have actual names, rather than positions. Good names are important,
182181
and with a struct, we have actual names.
183182

184183
There _is_ one case when a tuple struct is very useful, though, and that's a
185-
tuple struct with only one element. We call this a 'newtype,' because it lets
184+
tuple struct with only one element. We call this a *newtype*, because it lets
186185
you create a new type that's a synonym for another one:
187186

188187
```{rust}
@@ -199,7 +198,7 @@ destructuring `let`.
199198

200199
## Enums
201200

202-
Finally, Rust has a "sum type", an **enum**. Enums are an incredibly useful
201+
Finally, Rust has a "sum type", an *enum*. Enums are an incredibly useful
203202
feature of Rust, and are used throughout the standard library. This is an enum
204203
that is provided by the Rust standard library:
205204

branches/try/src/doc/trpl/crates-and-modules.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ these kinds of things, Rust has a module system.
88

99
# Basic terminology: Crates and Modules
1010

11-
Rust has two distinct terms that relate to the module system: "crate" and
12-
"module." A crate is synonymous with a 'library' or 'package' in other
11+
Rust has two distinct terms that relate to the module system: *crate* and
12+
*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
1515
shared library, depending on the project.
1616

17-
Each crate has an implicit "root module" that contains the code for that crate.
17+
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
1919
you to partition your code within the crate itself.
2020

21-
As an example, let's make a "phrases" crate, which will give us various phrases
21+
As an example, let's make a *phrases* crate, which will give us various phrases
2222
in different languages. To keep things simple, we'll stick to "greetings" and
2323
"farewells" as two kinds of phrases, and use English and Japanese (日本語) as
2424
two languages for those phrases to be in. We'll use this module layout:
@@ -45,7 +45,7 @@ two languages for those phrases to be in. We'll use this module layout:
4545

4646
In this example, `phrases` is the name of our crate. All of the rest are
4747
modules. You can see that they form a tree, branching out from the crate
48-
"root", which is the root of the tree: `phrases` itself.
48+
*root*, which is the root of the tree: `phrases` itself.
4949

5050
Now that we have a plan, let's define these modules in code. To start,
5151
generate a new crate with Cargo:

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ how to handle each. Then, we'll discuss upgrading failures to panics.
1616
# Failure vs. Panic
1717

1818
Rust uses two terms to differentiate between two forms of error: failure, and
19-
panic. A **failure** is an error that can be recovered from in some way. A
20-
**panic** is an error that cannot be recovered from.
19+
panic. A *failure* is an error that can be recovered from in some way. A
20+
*panic* is an error that cannot be recovered from.
2121

22-
What do we mean by 'recover'? Well, in most cases, the possibility of an error
22+
What do we mean by "recover"? Well, in most cases, the possibility of an error
2323
is expected. For example, consider the `from_str` function:
2424

2525
```{rust,ignore}
@@ -35,7 +35,7 @@ from_str("hello5world");
3535
```
3636

3737
This won't work. So we know that this function will only work properly for some
38-
inputs. It's expected behavior. We call this kind of error 'failure.'
38+
inputs. It's expected behavior. We call this kind of error a *failure*.
3939

4040
On the other hand, sometimes, there are errors that are unexpected, or which
4141
we cannot recover from. A classic example is an `assert!`:
@@ -46,7 +46,7 @@ assert!(x == 5);
4646

4747
We use `assert!` to declare that something is true. If it's not true, something
4848
is very wrong. Wrong enough that we can't continue with things in the current
49-
state. Another example is using the `unreachable!()` macro
49+
state. Another example is using the `unreachable!()` macro:
5050

5151
```{rust,ignore}
5252
enum Event {
@@ -114,7 +114,7 @@ fn main() {
114114

115115
We shouldn't ever hit the `_` case, so we use the `unreachable!()` macro to
116116
indicate this. `unreachable!()` gives a different kind of error than `Result`.
117-
Rust calls these sorts of errors 'panics.'
117+
Rust calls these sorts of errors *panics*.
118118

119119
# Handling errors with `Option` and `Result`
120120

branches/try/src/doc/trpl/ffi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ GitHub](https://github.com/thestinger/rust-snappy).
166166

167167
# Stack management
168168

169-
Rust tasks by default run on a "large stack". This is actually implemented as a
169+
Rust tasks by default run on a *large stack*. This is actually implemented as a
170170
reserving a large segment of the address space and then lazily mapping in pages
171171
as they are needed. When calling an external C function, the code is invoked on
172172
the same stack as the rust stack. This means that there is no extra

branches/try/src/doc/trpl/functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
```
99

1010
This is the simplest possible function declaration. As we mentioned before,
11-
`fn` says 'this is a function,' followed by the name, some parentheses because
11+
`fn` says "this is a function," followed by the name, some parentheses because
1212
this function takes no arguments, and then some curly braces to indicate the
1313
body. Here's a function named `foo`:
1414

@@ -86,7 +86,7 @@ fn add_one(x: i32) -> i32 {
8686
```
8787

8888
Rust functions return exactly one value, and you declare the type after an
89-
'arrow', which is a dash (`-`) followed by a greater-than sign (`>`).
89+
"arrow," which is a dash (`-`) followed by a greater-than sign (`>`).
9090

9191
You'll note the lack of a semicolon here. If we added it in:
9292

branches/try/src/doc/trpl/generics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ enum OptionalFloat64 {
2020
```
2121

2222
This is really unfortunate. Luckily, Rust has a feature that gives us a better
23-
way: generics. Generics are called **parametric polymorphism** in type theory,
24-
which means that they are types or functions that have multiple forms ("poly"
25-
is multiple, "morph" is form) over a given parameter ("parametric").
23+
way: generics. Generics are called *parametric polymorphism* in type theory,
24+
which means that they are types or functions that have multiple forms (*poly*
25+
is multiple, *morph* is form) over a given parameter (*parametric*).
2626

2727
Anyway, enough with type theory declarations, let's check out the generic form
2828
of `OptionalInt`. It is actually provided by Rust itself, and looks like this:
@@ -150,7 +150,7 @@ fn inverse32(x: f32) -> Result<f32, String> {
150150
}
151151
```
152152

153-
Bummer. What we need is a **generic function**. Luckily, we can write one!
153+
Bummer. What we need is a *generic function*. Luckily, we can write one!
154154
However, it won't _quite_ work yet. Before we get into that, let's talk syntax.
155155
A generic version of `inverse` would look something like this:
156156

branches/try/src/doc/trpl/guessing-game.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Enter the docs. Rust has a page specifically to document the standard library.
111111
You can find that page [here](../std/index.html). There's a lot of information on
112112
that page, but the best part is the search bar. Right up at the top, there's
113113
a box that you can enter in a search term. The search is pretty primitive
114-
right now, but is getting better all the time. If you type 'random' in that
114+
right now, but is getting better all the time. If you type "random" in that
115115
box, the page will update to [this one](../std/index.html?search=random). The very
116116
first result is a link to [`std::rand::random`](../std/rand/fn.random.html). If we
117117
click on that result, we'll be taken to its documentation page.
@@ -147,7 +147,7 @@ explained. We then added in a `let` expression to create a variable binding
147147
named `secret_number`, and we printed out its result.
148148

149149
Also, you may wonder why we are using `%` on the result of `rand::random()`.
150-
This operator is called 'modulo', and it returns the remainder of a division.
150+
This operator is called *modulo*, and it returns the remainder of a division.
151151
By taking the modulo of the result of `rand::random()`, we're limiting the
152152
values to be between 0 and 99. Then, we add one to the result, making it from 1
153153
to 100. Using modulo can give you a very, very small bias in the result, but
@@ -608,8 +608,8 @@ out that I guessed 76. Run the program a few times, and verify that guessing
608608
the number works, as well as guessing a number too small.
609609
610610
The Rust compiler helped us out quite a bit there! This technique is called
611-
"lean on the compiler", and it's often useful when working on some code. Let
612-
the error messages help guide you towards the correct types.
611+
"leaning on the compiler", and it's often useful when working on some code.
612+
Let the error messages help guide you towards the correct types.
613613
614614
Now we've got most of the game working, but we can only make one guess. Let's
615615
change that by adding loops!

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ it explain itself to you:
6666
6767
TOML is very similar to INI, but with some extra goodies.
6868

69-
Anyway, there are two **table**s in this file: `package` and `bin`. The first
69+
Anyway, there are two *tables* in this file: `package` and `bin`. The first
7070
tells Cargo metadata about your package. The second tells Cargo that we're
7171
interested in building a binary, not a library (though we could do both!), as
7272
well as what it is named.

0 commit comments

Comments
 (0)