rust/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
361 B
Rust
Raw Normal View History

2018-10-15 12:07:19 +00:00
#![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 //~ ERROR cannot move out of `*array`
2018-10-15 12:07:19 +00:00
}
None => vec![]
};
}
fn main() { }