summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/suggest-local-var-for-vector.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/suggest-local-var-for-vector.stderr')
-rw-r--r--tests/ui/borrowck/suggest-local-var-for-vector.stderr24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr
new file mode 100644
index 000000000..615fffcd5
--- /dev/null
+++ b/tests/ui/borrowck/suggest-local-var-for-vector.stderr
@@ -0,0 +1,24 @@
+error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mutable
+ --> $DIR/suggest-local-var-for-vector.rs:3:9
+ |
+LL | vec[vec.len() - 1] = 123;
+ | ----^^^^^^^^^-----
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | mutable borrow later used here
+ |
+help: try adding a local storing this...
+ --> $DIR/suggest-local-var-for-vector.rs:3:9
+ |
+LL | vec[vec.len() - 1] = 123;
+ | ^^^^^^^^^
+help: ...and then using that local here
+ --> $DIR/suggest-local-var-for-vector.rs:3:5
+ |
+LL | vec[vec.len() - 1] = 123;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.