about summary refs log tree commit diff
path: root/tests/ui/pattern
diff options
context:
space:
mode:
authorsurechen <chenshuo17@huawei.com>2023-09-06 11:33:03 +0800
committersurechen <chenshuo17@huawei.com>2023-09-07 11:07:33 +0800
commita8f3c7684df5ac15c770ef92d58436aa3386cfcf (patch)
tree7ec26fd8d3070f666722b20c5180804df3981e54 /tests/ui/pattern
parentb14b0745ad4913a21f00795738c047d0107dff4a (diff)
downloadrust-a8f3c7684df5ac15c770ef92d58436aa3386cfcf.tar.gz
rust-a8f3c7684df5ac15c770ef92d58436aa3386cfcf.zip
fixes #114896
Diffstat (limited to 'tests/ui/pattern')
-rw-r--r--tests/ui/pattern/issue-114896.rs7
-rw-r--r--tests/ui/pattern/issue-114896.stderr11
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/pattern/issue-114896.rs b/tests/ui/pattern/issue-114896.rs
new file mode 100644
index 00000000000..cde37f658d6
--- /dev/null
+++ b/tests/ui/pattern/issue-114896.rs
@@ -0,0 +1,7 @@
+fn main() {
+    fn x(a: &char) {
+        let &b = a;
+        b.make_ascii_uppercase();
+//~^ cannot borrow `b` as mutable, as it is not declared as mutable
+    }
+}
diff --git a/tests/ui/pattern/issue-114896.stderr b/tests/ui/pattern/issue-114896.stderr
new file mode 100644
index 00000000000..ffeb7bc1365
--- /dev/null
+++ b/tests/ui/pattern/issue-114896.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
+  --> $DIR/issue-114896.rs:4:9
+   |
+LL |         let &b = a;
+   |             -- help: consider changing this to be mutable: `&(mut b)`
+LL |         b.make_ascii_uppercase();
+   |         ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.