rust/tests/ui/closures/2229_closure_analysis/array_subslice.rs

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

14 lines
285 B
Rust
Raw Normal View History

2023-03-27 16:23:10 -05:00
// 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() {}