os-rust/src/test/ui/rfc-0107-bind-by-move-pattern-guards
bors 45859b7ca7 Auto merge of #63118 - Centril:stabilize-bind-by-move, r=matthewjasper
Stabilize `bind_by_move_pattern_guards` in Rust 1.39.0

Closes https://github.com/rust-lang/rust/issues/15287.

After stabilizing `#![feature(bind_by_move_pattern_guards)]`, you can now use bind-by-move bindings in patterns and take references to those bindings in `if` guards of `match` expressions. For example, the following now becomes legal:

```rust
fn main() {
    let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]);

    match array {
        nums
//      ---- `nums` is bound by move.
            if nums.iter().sum::<u8>() == 10
//                 ^------ `.iter()` implicitly takes a reference to `nums`.
        => {
            drop(nums);
//          --------- Legal as `nums` was bound by move and so we have ownership.
        }
        _ => unreachable!(),
    }
}
```

r? @matthewjasper
2019-09-09 12:46:59 +00:00
..
bind-by-move-no-guards.rs Auto merge of #63118 - Centril:stabilize-bind-by-move, r=matthewjasper 2019-09-09 12:46:59 +00:00
former-E0008-now-pass.rs Update tests wrt. bind_by_by_move_pattern_guards stabilization. 2019-09-08 01:39:24 +02:00
rfc-basic-examples.rs Update tests wrt. bind_by_by_move_pattern_guards stabilization. 2019-09-08 01:39:24 +02:00
rfc-reject-double-move-across-arms.rs Update tests wrt. bind_by_by_move_pattern_guards stabilization. 2019-09-08 01:39:24 +02:00
rfc-reject-double-move-across-arms.stderr Update tests wrt. bind_by_by_move_pattern_guards stabilization. 2019-09-08 01:39:24 +02:00
rfc-reject-double-move-in-first-arm.rs Update tests wrt. bind_by_by_move_pattern_guards stabilization. 2019-09-08 01:39:24 +02:00
rfc-reject-double-move-in-first-arm.stderr Update tests wrt. bind_by_by_move_pattern_guards stabilization. 2019-09-08 01:39:24 +02:00