summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-for-loop-head-linkage.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/borrowck-for-loop-head-linkage.stderr')
-rw-r--r--tests/ui/borrowck/borrowck-for-loop-head-linkage.stderr27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-for-loop-head-linkage.stderr b/tests/ui/borrowck/borrowck-for-loop-head-linkage.stderr
new file mode 100644
index 000000000..f47dce453
--- /dev/null
+++ b/tests/ui/borrowck/borrowck-for-loop-head-linkage.stderr
@@ -0,0 +1,27 @@
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-for-loop-head-linkage.rs:7:9
+ |
+LL | for &x in &vector {
+ | -------
+ | |
+ | immutable borrow occurs here
+ | immutable borrow later used here
+LL | let cap = vector.capacity();
+LL | vector.extend(repeat(0));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-for-loop-head-linkage.rs:8:9
+ |
+LL | for &x in &vector {
+ | -------
+ | |
+ | immutable borrow occurs here
+ | immutable borrow later used here
+...
+LL | vector[1] = 5;
+ | ^^^^^^ mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.