Skip to content

Commit

Permalink
Auto merge of #28476 - steveklabnik:rollup, r=steveklabnik
Browse files Browse the repository at this point in the history
- Successful merges: #28276, #28314, #28422, #28435, #28451, #28466, #28470, #28471, #28473, #28474
- Failed merges:
  • Loading branch information
bors committed Sep 17, 2015
2 parents a06812f + 5faff5d commit cff0411
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 104 deletions.
24 changes: 12 additions & 12 deletions src/doc/reference.md
Expand Up @@ -2762,7 +2762,7 @@ The following expressions are equivalent.
let x = std::ops::Range {start: 0, end: 10};
let y = 0..10;
assert_eq!(x,y);
assert_eq!(x, y);
```

### Unary operator expressions
Expand Down Expand Up @@ -3035,18 +3035,18 @@ A `loop` expression may optionally have a _label_. The label is written as
a lifetime preceding the loop expression, as in `'foo: loop{ }`. If a
label is present, then labeled `break` and `continue` expressions nested
within this loop may exit out of this loop or return control to its head.
See [Break expressions](#break-expressions) and [Continue
See [break expressions](#break-expressions) and [continue
expressions](#continue-expressions).

### Break expressions
### `break` expressions

A `break` expression has an optional _label_. If the label is absent, then
executing a `break` expression immediately terminates the innermost loop
enclosing it. It is only permitted in the body of a loop. If the label is
present, then `break 'foo` terminates the loop with label `'foo`, which need not
be the innermost label enclosing the `break` expression, but must enclose it.

### Continue expressions
### `continue` expressions

A `continue` expression has an optional _label_. If the label is absent, then
executing a `continue` expression immediately terminates the current iteration
Expand All @@ -3059,7 +3059,7 @@ innermost label enclosing the `break` expression, but must enclose it.

A `continue` expression is only permitted in the body of a loop.

### While loops
### `while` loops

A `while` loop begins by evaluating the boolean loop conditional expression.
If the loop conditional expression evaluates to `true`, the loop body block
Expand All @@ -3082,12 +3082,12 @@ Like `loop` expressions, `while` loops can be controlled with `break` or
loops](#infinite-loops), [break expressions](#break-expressions), and
[continue expressions](#continue-expressions) for more information.

### For expressions
### `for` expressions

A `for` expression is a syntactic construct for looping over elements provided
by an implementation of `std::iter::IntoIterator`.

An example of a for loop over the contents of an array:
An example of a `for` loop over the contents of an array:

```
# type Foo = i32;
Expand Down Expand Up @@ -3117,7 +3117,7 @@ Like `loop` expressions, `for` loops can be controlled with `break` or
loops](#infinite-loops), [break expressions](#break-expressions), and
[continue expressions](#continue-expressions) for more information.

### If expressions
### `if` expressions

An `if` expression is a conditional branch in program control. The form of an
`if` expression is a condition expression, followed by a consequent block, any
Expand All @@ -3129,7 +3129,7 @@ evaluates to `false`, the consequent block is skipped and any subsequent `else
if` condition is evaluated. If all `if` and `else if` conditions evaluate to
`false` then any `else` block is executed.

### Match expressions
### `match` expressions

A `match` expression branches on a *pattern*. The exact form of matching that
occurs depends on the pattern. Patterns consist of some combination of
Expand Down Expand Up @@ -3235,7 +3235,7 @@ let message = match maybe_digit {
};
```

### If let expressions
### `if let` expressions

An `if let` expression is semantically identical to an `if` expression but in place
of a condition expression it expects a refutable let statement. If the value of the
Expand All @@ -3256,15 +3256,15 @@ if let ("Ham", b) = dish {
}
```

### While let loops
### `while let` loops

A `while let` loop is semantically identical to a `while` loop but in place of a
condition expression it expects a refutable let statement. If the value of the
expression on the right hand side of the let statement matches the pattern, the
loop body block executes and control returns to the pattern matching statement.
Otherwise, the while expression completes.

### Return expressions
### `return` expressions

Return expressions are denoted with the keyword `return`. Evaluating a `return`
expression moves its argument into the designated output location for the
Expand Down
5 changes: 4 additions & 1 deletion src/doc/trpl/error-handling.md
Expand Up @@ -87,7 +87,9 @@ thread '<main>' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
Here's another example that is slightly less contrived. A program that accepts
an integer as an argument, doubles it and prints it.

<a name="code-unwrap-double"/>
```rust,should_panic
use std::env;
fn main() {
Expand Down Expand Up @@ -120,7 +122,7 @@ It would be better if we just showed the code for unwrapping because it is so
simple, but to do that, we will first need to explore the `Option` and `Result`
types. Both of these types have a method called `unwrap` defined on them.

## The `Option` type
### The `Option` type

The `Option` type is [defined in the standard library][5]:

Expand All @@ -137,6 +139,7 @@ system is an important concept because it will cause the compiler to force the
programmer to handle that absence. Let's take a look at an example that tries
to find a character in a string:

<a name="code-option-ex-string-find"/>
```rust
// Searches `haystack` for the Unicode character `needle`. If one is found, the
// byte offset of the character is returned. Otherwise, `None` is returned.
Expand Down
6 changes: 3 additions & 3 deletions src/doc/trpl/guessing-game.md
Expand Up @@ -599,7 +599,7 @@ With this definition, anything of type `Foo` can be either a
`Foo::Bar` or a `Foo::Baz`. We use the `::` to indicate the
namespace for a particular `enum` variant.

The [`Ordering`][ordering] enum has three possible variants: `Less`, `Equal`,
The [`Ordering`][ordering] `enum` has three possible variants: `Less`, `Equal`,
and `Greater`. The `match` statement takes a value of a type, and lets you
create an ‘arm’ for each possible value. Since we have three types of
`Ordering`, we have three arms:
Expand Down Expand Up @@ -918,9 +918,9 @@ let guess: u32 = match guess.trim().parse() {
This is how you generally move from ‘crash on error’ to ‘actually handle the
error’, by switching from `ok().expect()` to a `match` statement. The `Result`
returned by `parse()` is an enum just like `Ordering`, but in this case, each
returned by `parse()` is an `enum` just like `Ordering`, but in this case, each
variant has some data associated with it: `Ok` is a success, and `Err` is a
failure. Each contains more information: the successful parsed integer, or an
failure. Each contains more information: the successfully parsed integer, or an
error type. In this case, we `match` on `Ok(num)`, which sets the inner value
of the `Ok` to the name `num`, and then we just return it on the right-hand
side. In the `Err` case, we don’t care what kind of error it is, so we just
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/installing-rust.md
Expand Up @@ -64,7 +64,7 @@ Oh, we should also mention the officially supported platforms:

* Windows (7, 8, Server 2008 R2)
* Linux (2.6.18 or later, various distributions), x86 and x86-64
* OSX 10.7 (Lion) or greater, x86 and x86-64
* OSX 10.7 (Lion) or later, x86 and x86-64

We extensively test Rust on these platforms, and a few others, too, like
Android. But these are the ones most likely to work, as they have the most
Expand Down

0 comments on commit cff0411

Please sign in to comment.