about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-09-09 12:46:59 +0000
committerbors <bors@rust-lang.org>2019-09-09 12:46:59 +0000
commit45859b7ca764cafb14efb8c63a83d5e48dc5d016 (patch)
treeb661a47783cc8d2bf5b6c7419f6fcf0521d27538 /src/libcore
parent824383d4ab66abd32abc6e19b68d78ecfddcb7d4 (diff)
parentaaa9762651c15ee16ae210b18c843bceab7bf454 (diff)
downloadrust-45859b7ca764cafb14efb8c63a83d5e48dc5d016.tar.gz
rust-45859b7ca764cafb14efb8c63a83d5e48dc5d016.zip
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
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 690cff483b0..a2cc585fc51 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -87,7 +87,7 @@
 #![feature(link_llvm_intrinsics)]
 #![feature(never_type)]
 #![feature(nll)]
-#![feature(bind_by_move_pattern_guards)]
+#![cfg_attr(boostrap_stdarch_ignore_this, feature(bind_by_move_pattern_guards))]
 #![feature(exhaustive_patterns)]
 #![feature(no_core)]
 #![feature(on_unimplemented)]