summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/array_subslice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/closures/2229_closure_analysis/array_subslice.rs')
-rw-r--r--tests/ui/closures/2229_closure_analysis/array_subslice.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/closures/2229_closure_analysis/array_subslice.rs b/tests/ui/closures/2229_closure_analysis/array_subslice.rs
new file mode 100644
index 000000000..5f244ea89
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/array_subslice.rs
@@ -0,0 +1,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() {}