Skip to content

Commit

Permalink
regression test for issue rust-lang#54597
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Oct 15, 2018
1 parent 0e07c42 commit 481ad0e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#![feature(nll)]

#![allow(dead_code)]

#[derive(Debug)]
struct Value;
impl Value {
fn as_array(&self) -> Option<&Vec<Value>> {
None
}
}

fn foo(val: Value) {
let _reviewers_original: Vec<Value> = match val.as_array() {
Some(array) => {
*array
}
None => vec![]
};
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13
|
LL | *array
| ^^^^^^
| |
| cannot move out of borrowed content
| help: consider removing the `*`: `array`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0507`.

0 comments on commit 481ad0e

Please sign in to comment.