Skip to content

Commit

Permalink
Auto merge of #26844 - steveklabnik:rollup, r=steveklabnik
Browse files Browse the repository at this point in the history
- Successful merges: #26599, #26761, #26807, #26809, #26825, #26827, #26828, #26832, #26834, #26835
- Failed merges: #26796
  • Loading branch information
bors committed Jul 7, 2015
2 parents 6d71ce5 + 04a85c5 commit 26f0cd5
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 33 deletions.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ feature. We use the 'fork and pull' model described there.

Please make pull requests against the `master` branch.

Compiling all of `make check` can take a while. When testing your pull request,
consider using one of the more specialized `make` targets to cut down on the
amount of time you have to wait. You need to have built the compiler at least
once before running these will work, but that’s only one full build rather than
one each time.

$ make -j8 rustc-stage1 && make check-stage1

is one such example, which builds just `rustc`, and then runs the tests. If
you’re adding something to the standard library, try

$ make -j8 check-stage1-std NO_REBUILD=1

This will not rebuild the compiler, but will run the tests.

All pull requests are reviewed by another person. We have a bot,
@rust-highfive, that will automatically assign a random person to review your
request.
Expand All @@ -108,6 +123,10 @@ will run all the tests on every platform we support. If it all works out,

[merge-queue]: http://buildbot.rust-lang.org/homu/queue/rust

Speaking of tests, Rust has a comprehensive test suite. More information about
it can be found
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).

## Writing Documentation

Documentation improvements are very welcome. The source of `doc.rust-lang.org`
Expand Down
6 changes: 2 additions & 4 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2515,9 +2515,8 @@ Here are some examples:
#### Moved and copied types

When a [local variable](#variables) is used as an
[rvalue](#lvalues,-rvalues-and-temporaries) the variable will either be moved
or copied, depending on its type. All values whose type implements `Copy` are
copied, all others are moved.
[rvalue](#lvalues,-rvalues-and-temporaries), the variable will be copied
if its type implements `Copy`. All others are moved.

### Literal expressions

Expand Down Expand Up @@ -2882,7 +2881,6 @@ operand.
```
# let mut x = 0;
# let y = 0;
x = y;
```

Expand Down
17 changes: 4 additions & 13 deletions src/doc/trpl/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,10 @@ attribute turns off Rust's name mangling, so that it is easier to link to.

# FFI and panics

It’s important to be mindful of `panic!`s when working with FFI. This code,
when called from C, will `abort`:

```rust
#[no_mangle]
pub extern fn oh_no() -> ! {
panic!("Oops!");
}
# fn main() {}
```

If you’re writing code that may panic, you should run it in another thread,
so that the panic doesn’t bubble up to C:
It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
across an FFI boundary is undefined behavior. If you’re writing code that may
panic, you should run it in another thread, so that the panic doesn’t bubble up
to C:

```rust
use std::thread;
Expand Down
32 changes: 32 additions & 0 deletions src/doc/trpl/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,38 @@ This ‘destructuring’ behavior works on any compound data type, like
[tuples]: primitive-types.html#tuples
[enums]: enums.html

# Ignoring bindings

You can use `_` in a pattern to disregard the value. For example, here’s a
`match` against a `Result<T, E>`:

```rust
# let some_value: Result<i32, &'static str> = Err("There was an error");
match some_value {
Ok(value) => println!("got a value: {}", value),
Err(_) => println!("an error occurred"),
}
```

In the first arm, we bind the value inside the `Ok` variant to `value`. But
in the `Err` arm, we use `_` to disregard the specific error, and just print
a general error message.

`_` is valid in any pattern that creates a binding. This can be useful to
ignore parts of a larger structure:

```rust
fn coordinate() -> (i32, i32, i32) {
// generate and return some sort of triple tuple
# (1, 2, 3)
}

let (x, _, z) = coordinate();
```

Here, we bind the first and last element of the tuple to `x` and `z`, but
ignore the middle element.

# Mix and Match

Whew! That’s a lot of different ways to match things, and they can all be
Expand Down
Loading

0 comments on commit 26f0cd5

Please sign in to comment.