summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs
blob: 3e46ee6f0789a8ccf1af1ca6b8e6064fd4826f81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![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`
        }
        None => vec![]
    };
}

fn main() { }