Skip to content

Commit 7d945e2

Browse files
committed
---
yaml --- r: 172763 b: refs/heads/try c: 1ca581d h: refs/heads/master i: 172761: aadc7d7 172759: f723d82 v: v3
1 parent bab19dd commit 7d945e2

Some content is hidden

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

70 files changed

+378
-392
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: 2a29296ea3f891f3216962d0ba8ada078a0657e6
5+
refs/heads/try: 1ca581d440d95c13c9f84508f92094d460518d58
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/compiletest/header.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ pub struct TestProps {
4242
pub pretty_compare_only: bool,
4343
// Patterns which must not appear in the output of a cfail test.
4444
pub forbid_output: Vec<String>,
45-
// Ignore errors which originate from a command line span
46-
pub ignore_command_line: bool,
4745
}
4846

4947
// Load any test directives embedded in the file
@@ -62,8 +60,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
6260
let mut pretty_mode = None;
6361
let mut pretty_compare_only = false;
6462
let mut forbid_output = Vec::new();
65-
let mut ignore_command_line = false;
66-
6763
iter_header(testfile, |ln| {
6864
match parse_error_pattern(ln) {
6965
Some(ep) => error_patterns.push(ep),
@@ -106,10 +102,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
106102
pretty_compare_only = parse_pretty_compare_only(ln);
107103
}
108104

109-
if !ignore_command_line {
110-
ignore_command_line = parse_ignore_command_line(ln);
111-
}
112-
113105
match parse_aux_build(ln) {
114106
Some(ab) => { aux_builds.push(ab); }
115107
None => {}
@@ -148,7 +140,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
148140
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
149141
pretty_compare_only: pretty_compare_only,
150142
forbid_output: forbid_output,
151-
ignore_command_line: ignore_command_line,
152143
}
153144
}
154145

@@ -300,10 +291,6 @@ fn parse_pretty_compare_only(line: &str) -> bool {
300291
parse_name_directive(line, "pretty-compare-only")
301292
}
302293

303-
fn parse_ignore_command_line(line: &str) -> bool {
304-
parse_name_directive(line, "ignore-command-line")
305-
}
306-
307294
fn parse_exec_env(line: &str) -> Option<(String, String)> {
308295
parse_name_value_directive(line, "exec-env").map(|nv| {
309296
// nv is either FOO or FOO=BAR

branches/try/src/compiletest/runtest.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
104104
if !props.error_patterns.is_empty() {
105105
fatal("both error pattern and expected errors specified");
106106
}
107-
check_expected_errors(props, expected_errors, testfile, &proc_res);
107+
check_expected_errors(expected_errors, testfile, &proc_res);
108108
} else {
109109
check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res);
110110
}
@@ -941,8 +941,7 @@ fn check_forbid_output(props: &TestProps,
941941
}
942942
}
943943

944-
fn check_expected_errors(props: &TestProps,
945-
expected_errors: Vec<errors::ExpectedError> ,
944+
fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
946945
testfile: &Path,
947946
proc_res: &ProcRes) {
948947

@@ -997,11 +996,6 @@ fn check_expected_errors(props: &TestProps,
997996
was_expected = true;
998997
}
999998

1000-
if line.starts_with("<command line option>") &&
1001-
props.ignore_command_line {
1002-
was_expected = true;
1003-
}
1004-
1005999
if !was_expected && is_compiler_error_or_warning(line) {
10061000
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
10071001
line).as_slice(),

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/advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% Advanced
22

3-
In a similar fashion to "Intermediate," this setion is full of individual,
3+
In a similar fashion to "Intermediate," this section is full of individual,
44
deep-dive chapters, which stand alone and can be read in any order. These
55
chapters focus on the most complex features, as well as some things that
66
are only available in upcoming versions of Rust.

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
% Conclusion
22

33
We covered a lot of ground here. When you've mastered everything in this Guide,
4-
you will have a firm grasp of basic Rust development. There's a whole lot more
5-
out there, we've just covered the surface. There's tons of topics that you can
6-
dig deeper into, and we've built specialized guides for many of them. To learn
7-
more, dig into the [full documentation
8-
index](index.html).
4+
you will have a firm grasp of Rust development. There's a whole lot more
5+
out there, though, we've just covered the surface. There's tons of topics that
6+
you can dig deeper into, e.g. by reading the API documentation of the
7+
[standard library](http://doc.rust-lang.org/std/), by discovering solutions for
8+
common problems on [Rust by Example](http://rustbyexample.com/), or by browsing
9+
crates written by the community on [crates.io](https://crates.io/).
910

1011
Happy hacking!

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:

0 commit comments

Comments
 (0)