summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/array_subslice.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
commit631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch)
treea1b87c8f8cad01cf18f7c5f57a08f102771ed303 /tests/ui/closures/2229_closure_analysis/array_subslice.stderr
parentAdding debian version 1.69.0+dfsg1-1. (diff)
downloadrustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz
rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/closures/2229_closure_analysis/array_subslice.stderr')
-rw-r--r--tests/ui/closures/2229_closure_analysis/array_subslice.stderr26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/closures/2229_closure_analysis/array_subslice.stderr b/tests/ui/closures/2229_closure_analysis/array_subslice.stderr
new file mode 100644
index 000000000..888c60d5e
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/array_subslice.stderr
@@ -0,0 +1,26 @@
+error[E0596]: cannot borrow `x[..]` as mutable, as `x` is not declared as mutable
+ --> $DIR/array_subslice.rs:7:21
+ |
+LL | pub fn subslice_array(x: [u8; 3]) {
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | let [ref y, ref mut z @ ..] = x;
+ | ^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
+ --> $DIR/array_subslice.rs:10:5
+ |
+LL | let [ref y, ref mut z @ ..] = x;
+ | - calling `f` requires mutable binding due to mutable borrow of `x`
+...
+LL | f();
+ | ^ cannot borrow as mutable
+ |
+help: consider changing this to be mutable
+ |
+LL | let mut f = || {
+ | +++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.