Skip to content

Commit

Permalink
Auto merge of #32402 - steveklabnik:rollup, r=steveklabnik
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

- Successful merges: #32322, #32339, #32340, #32373, #32376, #32397
- Failed merges:
  • Loading branch information
bors committed Mar 22, 2016
2 parents 21922e1 + 6a3c7d5 commit 4621dd2
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 10 deletions.
10 changes: 10 additions & 0 deletions src/doc/book/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,16 @@ impl Error for CliError {
CliError::NotFound => "not found",
}
}
fn cause(&self) -> Option<&error::Error> {
match *self {
CliError::Io(ref err) => Some(err),
CliError::Parse(ref err) => Some(err),
// Our custom error doesn't have an underlying cause, but we could
// modify it so that it does.
CliError::NotFound() => None,
}
}
}
```

Expand Down
6 changes: 3 additions & 3 deletions src/doc/book/match.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ give us an error:
error: non-exhaustive patterns: `_` not covered
```

Rust is telling us that we forgot a value. The compiler infers from `x` that it
can have any positive 32bit value; for example 1 to 2,147,483,647. The `_` acts
Rust is telling us that we forgot some value. The compiler infers from `x` that it
can have any 32bit integer value; for example -2,147,483,648 to 2,147,483,647. The `_` acts
as a 'catch-all', and will catch all possible values that *aren't* specified in
an arm of `match`. As you can see with the previous example, we provide `match`
an arm of `match`. As you can see in the previous example, we provide `match`
arms for integers 1-5, if `x` is 6 or any other value, then it is caught by `_`.

`match` is also an expression, which means we can use it on the right-hand
Expand Down
8 changes: 4 additions & 4 deletions src/doc/book/primitive-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ of these ones, as well, but these are the most primitive.

# Booleans

Rust has a built in boolean type, named `bool`. It has two values, `true` and `false`:
Rust has a built-in boolean type, named `bool`. It has two values, `true` and `false`:

```rust
let x = true;
Expand Down Expand Up @@ -89,13 +89,13 @@ Unsigned types use a `u` for their category, and signed types use `i`. The `i`
is for ‘integer’. So `u8` is an eight-bit unsigned number, and `i8` is an
eight-bit signed number.

## Fixed size types
## Fixed-size types

Fixed size types have a specific number of bits in their representation. Valid
Fixed-size types have a specific number of bits in their representation. Valid
bit sizes are `8`, `16`, `32`, and `64`. So, `u32` is an unsigned, 32-bit integer,
and `i64` is a signed, 64-bit integer.

## Variable sized types
## Variable-size types

Rust also provides types whose size depends on the size of a pointer of the
underlying machine. These types have ‘size’ as the category, and come in signed
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/references-and-borrowing.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ fn main() {

In other words, the mutable borrow is held through the rest of our example. What
we want is for the mutable borrow by `y` to end so that the resource can be
returned to the owner, `x`. `x` can then provide a mutable borrow to `println!`.
returned to the owner, `x`. `x` can then provide a immutable borrow to `println!`.
In Rust, borrowing is tied to the scope that the borrow is valid for. And our
scopes look like this:

Expand Down
35 changes: 35 additions & 0 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
//! by the compiler to implement comparison operators. Rust programs may
//! implement `PartialOrd` to overload the `<`, `<=`, `>`, and `>=` operators,
//! and may implement `PartialEq` to overload the `==` and `!=` operators.
//!
//! # Examples
//!
//! ```
//! let x: u32 = 0;
//! let y: u32 = 1;
//!
//! // these two lines are equivalent
//! assert_eq!(x < y, true);
//! assert_eq!(x.lt(&y), true);
//!
//! // these two lines are also equivalent
//! assert_eq!(x == y, false);
//! assert_eq!(x.eq(&y), false);
//! ```

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down