summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/array_subslice.rs
blob: 5f244ea89365d4bac763af777c9a2c72ec07f136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// regression test for #109298
// edition: 2021

pub fn subslice_array(x: [u8; 3]) {
    let f = || {
        let [_x @ ..] = x;
        let [ref y, ref mut z @ ..] = x; //~ ERROR cannot borrow `x[..]` as mutable
    };

    f(); //~ ERROR cannot borrow `f` as mutable
}

fn main() {}