Skip to content

Commit bab19dd

Browse files
author
Nathan Stoddard
committed
---
yaml --- r: 172762 b: refs/heads/try c: 2a29296 h: refs/heads/master v: v3
1 parent aadc7d7 commit bab19dd

Some content is hidden

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

71 files changed

+394
-380
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: 507d9575bd266acbb084b0df78f23a774b0ba841
5+
refs/heads/try: 2a29296ea3f891f3216962d0ba8ada078a0657e6
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: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ 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-
3832
PDF_DOCS := reference
3933

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

284278
trpl: doc/book/index.html
285279

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

branches/try/src/compiletest/header.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ 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,
4547
}
4648

4749
// Load any test directives embedded in the file
@@ -60,6 +62,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
6062
let mut pretty_mode = None;
6163
let mut pretty_compare_only = false;
6264
let mut forbid_output = Vec::new();
65+
let mut ignore_command_line = false;
66+
6367
iter_header(testfile, |ln| {
6468
match parse_error_pattern(ln) {
6569
Some(ep) => error_patterns.push(ep),
@@ -102,6 +106,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
102106
pretty_compare_only = parse_pretty_compare_only(ln);
103107
}
104108

109+
if !ignore_command_line {
110+
ignore_command_line = parse_ignore_command_line(ln);
111+
}
112+
105113
match parse_aux_build(ln) {
106114
Some(ab) => { aux_builds.push(ab); }
107115
None => {}
@@ -140,6 +148,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
140148
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
141149
pretty_compare_only: pretty_compare_only,
142150
forbid_output: forbid_output,
151+
ignore_command_line: ignore_command_line,
143152
}
144153
}
145154

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

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

branches/try/src/compiletest/runtest.rs

Lines changed: 8 additions & 2 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(expected_errors, testfile, &proc_res);
107+
check_expected_errors(props, expected_errors, testfile, &proc_res);
108108
} else {
109109
check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res);
110110
}
@@ -941,7 +941,8 @@ fn check_forbid_output(props: &TestProps,
941941
}
942942
}
943943

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

@@ -996,6 +997,11 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
996997
was_expected = true;
997998
}
998999

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

branches/try/src/doc/guide.md

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ navigate through the menu on the left.
1111
## Basics
1212

1313
This section is a linear introduction to the basic syntax and semantics of
14-
Rust. It has individual sections on each part of Rust's syntax, and cumulates
14+
Rust. It has individual sections on each part of Rust's syntax, and culminates
1515
in a small project: a guessing game.
1616

1717
After reading "Basics," you will have a good foundation to learn more about

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 section is full of individual,
3+
In a similar fashion to "Intermediate," this setion 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 *closures*. By themselves, closures aren't all that
5+
functions are called **closure**s. 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 comments*
8-
and *doc comments*.
7+
Rust has two kinds of comments that you should care about: **line comment**s
8+
and **doc comment**s.
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: 14 additions & 13 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 *tuples*.
9+
The first compound data type we're going to talk about are called **tuple**s.
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
88-
example how you 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 example how you
88+
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,7 +143,8 @@ 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 don't:
146+
called a **tuple struct**. Tuple structs do have a name, but their fields
147+
don't:
147148

148149

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

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

187188
```{rust}
@@ -198,7 +199,7 @@ destructuring `let`.
198199

199200
## Enums
200201

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
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 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/).
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).
109

1110
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)