summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck')
-rw-r--r--tests/ui/borrowck/borrow-tuple-fields.stderr12
-rw-r--r--tests/ui/borrowck/borrowck-argument.stderr8
-rw-r--r--tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr6
-rw-r--r--tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr14
-rw-r--r--tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr6
-rw-r--r--tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-closures-unique-imm.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-describe-lvalue.stderr12
-rw-r--r--tests/ui/borrowck/borrowck-insert-during-each.stderr20
-rw-r--r--tests/ui/borrowck/borrowck-issue-2657-1.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-lend-flow-if.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-lend-flow.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr4
-rw-r--r--tests/ui/borrowck/borrowck-loan-blocks-move.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-rcvr.stderr18
-rw-r--r--tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr7
-rw-r--r--tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr15
-rw-r--r--tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr4
-rw-r--r--tests/ui/borrowck/borrowck-object-lifetime.stderr8
-rw-r--r--tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr16
-rw-r--r--tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr6
-rw-r--r--tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-union-borrow-nested.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-uniq-via-lend.stderr4
-rw-r--r--tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr5
-rw-r--r--tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr4
-rw-r--r--tests/ui/borrowck/clone-span-on-try-operator.fixed11
-rw-r--r--tests/ui/borrowck/clone-span-on-try-operator.rs11
-rw-r--r--tests/ui/borrowck/clone-span-on-try-operator.stderr21
-rw-r--r--tests/ui/borrowck/copy-suggestion-region-vid.rs1
-rw-r--r--tests/ui/borrowck/copy-suggestion-region-vid.stderr9
-rw-r--r--tests/ui/borrowck/index-mut-help-with-impl.stderr2
-rw-r--r--tests/ui/borrowck/index-mut-help.stderr7
-rw-r--r--tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr28
-rw-r--r--tests/ui/borrowck/issue-42344.stderr2
-rw-r--r--tests/ui/borrowck/issue-47646.stderr2
-rw-r--r--tests/ui/borrowck/issue-51117.stderr2
-rw-r--r--tests/ui/borrowck/issue-81365-10.stderr2
-rw-r--r--tests/ui/borrowck/issue-81365-5.stderr2
-rw-r--r--tests/ui/borrowck/issue-82032.stderr2
-rw-r--r--tests/ui/borrowck/issue-85581.stderr2
-rw-r--r--tests/ui/borrowck/issue-85765-closure.rs31
-rw-r--r--tests/ui/borrowck/issue-85765-closure.stderr48
-rw-r--r--tests/ui/borrowck/issue-85765.stderr2
-rw-r--r--tests/ui/borrowck/issue-91206.stderr2
-rw-r--r--tests/ui/borrowck/issue-93078.stderr2
-rw-r--r--tests/ui/borrowck/many-mutable-borrows.stderr18
-rw-r--r--tests/ui/borrowck/mut-borrow-of-mut-ref.stderr2
-rw-r--r--tests/ui/borrowck/mut-borrow-outside-loop.stderr4
-rw-r--r--tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr5
-rw-r--r--tests/ui/borrowck/suggest-local-var-double-mut.stderr5
-rw-r--r--tests/ui/borrowck/suggest-local-var-for-vector.stderr12
-rw-r--r--tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr5
-rw-r--r--tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr12
-rw-r--r--tests/ui/borrowck/two-phase-across-loop.stderr5
-rw-r--r--tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr19
-rw-r--r--tests/ui/borrowck/two-phase-multi-mut.stderr5
-rw-r--r--tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr28
-rw-r--r--tests/ui/borrowck/two-phase-sneaky.stderr2
-rw-r--r--tests/ui/borrowck/two-phase-surprise-no-conflict.stderr37
-rw-r--r--tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr2
67 files changed, 321 insertions, 226 deletions
diff --git a/tests/ui/borrowck/borrow-tuple-fields.stderr b/tests/ui/borrowck/borrow-tuple-fields.stderr
index d7d3efe49..e324ebfb5 100644
--- a/tests/ui/borrowck/borrow-tuple-fields.stderr
+++ b/tests/ui/borrowck/borrow-tuple-fields.stderr
@@ -9,7 +9,7 @@ LL | let y = x;
| ^ move out of `x` occurs here
LL |
LL | r.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
--> $DIR/borrow-tuple-fields.rs:18:13
@@ -19,7 +19,7 @@ LL | let a = &x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ mutable borrow occurs here
LL | a.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
--> $DIR/borrow-tuple-fields.rs:23:13
@@ -29,7 +29,7 @@ LL | let a = &mut x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ second mutable borrow occurs here
LL | a.use_ref();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrow-tuple-fields.rs:28:13
@@ -41,7 +41,7 @@ LL | let r = &x.0;
LL | let y = x;
| ^ move out of `x` occurs here
LL | r.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
--> $DIR/borrow-tuple-fields.rs:33:13
@@ -51,7 +51,7 @@ LL | let a = &x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ mutable borrow occurs here
LL | a.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
--> $DIR/borrow-tuple-fields.rs:38:13
@@ -61,7 +61,7 @@ LL | let a = &mut x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ second mutable borrow occurs here
LL | a.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to 6 previous errors
diff --git a/tests/ui/borrowck/borrowck-argument.stderr b/tests/ui/borrowck/borrowck-argument.stderr
index 1c992dfcc..8ad5623c8 100644
--- a/tests/ui/borrowck/borrowck-argument.stderr
+++ b/tests/ui/borrowck/borrowck-argument.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:10:5
|
LL | arg.mutate();
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -13,7 +13,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:15:9
|
LL | arg.mutate();
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -24,7 +24,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:21:9
|
LL | arg.mutate();
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -35,7 +35,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:32:17
|
LL | (|arg: S| { arg.mutate() })(s);
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
index 19ef0301a..25d642c30 100644
--- a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
+++ b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:15:5
|
LL | x.printme();
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
index 3c28ff56e..a61fdbf6c 100644
--- a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
+++ b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable
--> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5
|
LL | a.foo();
- | ^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
index 42b6c34cd..fa0ae318e 100644
--- a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
+++ b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
@@ -2,11 +2,11 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time
--> $DIR/borrowck-borrow-mut-object-twice.rs:13:5
|
LL | let y = x.f1();
- | ------ first mutable borrow occurs here
+ | - first mutable borrow occurs here
LL | x.f2();
- | ^^^^^^ second mutable borrow occurs here
+ | ^ second mutable borrow occurs here
LL | y.use_ref();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
index fdf6568d8..426d5bc47 100644
--- a/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
+++ b/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
@@ -58,7 +58,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:72:5
|
LL | x.set(0, 0);
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -66,7 +66,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:76:5
|
LL | x.set(0, 0);
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -74,7 +74,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:84:5
|
LL | x.y_mut()
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -82,7 +82,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:88:5
|
LL | x.y_mut()
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -90,7 +90,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:92:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -98,7 +98,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:96:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -106,7 +106,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:100:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
index 4eeec09b9..6e112e270 100644
--- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
+++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
@@ -8,8 +8,12 @@ LL | let x = defer(&vec!["Goodbye", "world!"]);
LL | x.x[0];
| ------ borrow later used here
|
- = note: consider using a `let` binding to create a longer lived value
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider using a `let` binding to create a longer lived value
+ |
+LL ~ let binding = vec!["Goodbye", "world!"];
+LL ~ let x = defer(&binding);
+ |
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
index c62d5f903..7ee840b34 100644
--- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
+++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
@@ -7,7 +7,7 @@ LL | buggy_map.insert(42, &*Box::new(1));
| creates a temporary value which is freed while still in use
...
LL | buggy_map.insert(43, &*tmp);
- | --------------------------- borrow later used here
+ | --------- borrow later used here
|
help: consider using a `let` binding to create a longer lived value
|
diff --git a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr
index 0c5fd39b7..b8bbb31a3 100644
--- a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr
+++ b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr
@@ -6,7 +6,7 @@ LL | let p = &this.x;
LL | &mut this.x;
| ^^^^^^^^^^^ mutable borrow occurs here
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-describe-lvalue.stderr b/tests/ui/borrowck/borrowck-describe-lvalue.stderr
index cb29c9fda..11f2e42d4 100644
--- a/tests/ui/borrowck/borrowck-describe-lvalue.stderr
+++ b/tests/ui/borrowck/borrowck-describe-lvalue.stderr
@@ -45,7 +45,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:37:9
|
LL | let x = f.x();
- | ----- `f` is borrowed here
+ | - `f` is borrowed here
LL | f.x;
| ^^^ use of borrowed `f`
LL | drop(x);
@@ -55,7 +55,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:44:9
|
LL | let x = g.x();
- | ----- `g` is borrowed here
+ | - `g` is borrowed here
LL | g.0;
| ^^^ use of borrowed `g`
LL | drop(x);
@@ -75,7 +75,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:59:20
|
LL | let x = e.x();
- | ----- `e` is borrowed here
+ | - `e` is borrowed here
LL | match e {
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `e`
@@ -97,7 +97,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:74:9
|
LL | let x = f.x();
- | ----- `*f` is borrowed here
+ | - `*f` is borrowed here
LL | f.x;
| ^^^ use of borrowed `*f`
LL | drop(x);
@@ -107,7 +107,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:81:9
|
LL | let x = g.x();
- | ----- `*g` is borrowed here
+ | - `*g` is borrowed here
LL | g.0;
| ^^^ use of borrowed `*g`
LL | drop(x);
@@ -127,7 +127,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:96:20
|
LL | let x = e.x();
- | ----- `*e` is borrowed here
+ | - `*e` is borrowed here
LL | match *e {
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `*e`
diff --git a/tests/ui/borrowck/borrowck-insert-during-each.stderr b/tests/ui/borrowck/borrowck-insert-during-each.stderr
index 99d08e905..a1ac45795 100644
--- a/tests/ui/borrowck/borrowck-insert-during-each.stderr
+++ b/tests/ui/borrowck/borrowck-insert-during-each.stderr
@@ -16,17 +16,15 @@ LL | | })
error[E0500]: closure requires unique access to `f` but it is already borrowed
--> $DIR/borrowck-insert-during-each.rs:18:9
|
-LL | f.foo(
- | - --- first borrow later used by call
- | _____|
- | |
-LL | |
-LL | | |a| {
- | | ^^^ closure construction occurs here
-LL | | f.n.insert(*a);
- | | --- second borrow occurs due to use of `f` in closure
-LL | | })
- | |__________- borrow occurs here
+LL | f.foo(
+ | - --- first borrow later used by call
+ | |
+ | borrow occurs here
+LL |
+LL | |a| {
+ | ^^^ closure construction occurs here
+LL | f.n.insert(*a);
+ | --- second borrow occurs due to use of `f` in closure
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-issue-2657-1.stderr b/tests/ui/borrowck/borrowck-issue-2657-1.stderr
index 390bb9384..4ea4eb8f0 100644
--- a/tests/ui/borrowck/borrowck-issue-2657-1.stderr
+++ b/tests/ui/borrowck/borrowck-issue-2657-1.stderr
@@ -6,7 +6,7 @@ LL | Some(ref _y) => {
LL | let _a = x;
| ^ move out of `x` occurs here
LL | _y.use_ref();
- | ------------ borrow later used here
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-lend-flow-if.stderr b/tests/ui/borrowck/borrowck-lend-flow-if.stderr
index e47efc0e0..68a82bdb5 100644
--- a/tests/ui/borrowck/borrowck-lend-flow-if.stderr
+++ b/tests/ui/borrowck/borrowck-lend-flow-if.stderr
@@ -7,7 +7,7 @@ LL | }
LL | borrow_mut(&mut *v);
| ^^^^^^^ mutable borrow occurs here
LL | _w.use_ref();
- | ------------ immutable borrow later used here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-lend-flow.stderr b/tests/ui/borrowck/borrowck-lend-flow.stderr
index 40c14f54c..07b11b3e7 100644
--- a/tests/ui/borrowck/borrowck-lend-flow.stderr
+++ b/tests/ui/borrowck/borrowck-lend-flow.stderr
@@ -6,7 +6,7 @@ LL | let _w = &v;
LL | borrow_mut(&mut *v);
| ^^^^^^^ mutable borrow occurs here
LL | _w.use_ref();
- | ------------ immutable borrow later used here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
index 6eabfff90..86479043a 100644
--- a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
+++ b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
@@ -12,7 +12,7 @@ LL | println!("v={}", *v);
| -- move occurs due to use in closure
LL | });
LL | w.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0505]: cannot move out of `v` because it is borrowed
--> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
@@ -28,7 +28,7 @@ LL | println!("v={}", *v);
| -- move occurs due to use in closure
LL | });
LL | w.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr
index 38e06fa01..de8da490c 100644
--- a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr
+++ b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr
@@ -8,7 +8,7 @@ LL | let w = &v;
LL | take(v);
| ^ move out of `v` occurs here
LL | w.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
index e1b991620..93622a0c5 100644
--- a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
+++ b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
@@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x`
LL | let x = Foo(Box::new(3));
| - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
- | - ^^^^^^^^^ value borrowed here after move
+ | - ^ value borrowed here after move
| |
| value moved here
|
diff --git a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
index f1640d3b7..bb90b2d15 100644
--- a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
+++ b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
@@ -17,7 +17,7 @@ LL | let q = &mut p;
| ------ mutable borrow occurs here
...
LL | p.times(3);
- | ^^^^^^^^^^ immutable borrow occurs here
+ | ^ immutable borrow occurs here
LL |
LL | *q + 3; // OK to use the new alias `q`
| -- mutable borrow later used here
diff --git a/tests/ui/borrowck/borrowck-loan-rcvr.stderr b/tests/ui/borrowck/borrowck-loan-rcvr.stderr
index 1d6bd4e2e..317423ecf 100644
--- a/tests/ui/borrowck/borrowck-loan-rcvr.stderr
+++ b/tests/ui/borrowck/borrowck-loan-rcvr.stderr
@@ -1,15 +1,13 @@
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-loan-rcvr.rs:23:14
|
-LL | p.blockm(|| {
- | - ------ ^^ mutable borrow occurs here
- | | |
- | _____| immutable borrow later used by call
- | |
-LL | | p.x = 10;
- | | --- second borrow occurs due to use of `p` in closure
-LL | | })
- | |______- immutable borrow occurs here
+LL | p.blockm(|| {
+ | - ------ ^^ mutable borrow occurs here
+ | | |
+ | | immutable borrow later used by call
+ | immutable borrow occurs here
+LL | p.x = 10;
+ | --- second borrow occurs due to use of `p` in closure
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-loan-rcvr.rs:34:5
@@ -17,7 +15,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta
LL | let l = &mut p;
| ------ mutable borrow occurs here
LL | p.impurem();
- | ^^^^^^^^^^^ immutable borrow occurs here
+ | ^ immutable borrow occurs here
LL |
LL | l.x += 1;
| -------- mutable borrow later used here
diff --git a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
index bd94f1a42..4f0202f38 100644
--- a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
+++ b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
@@ -9,7 +9,7 @@ LL |
LL | let z = *a;
| ^^ move out of `*a` occurs here
LL | b.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr
index cdad20c52..e1e3c7f8a 100644
--- a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr
+++ b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr
@@ -9,7 +9,7 @@ LL | let t1 = t0;
| ^^ move out of `t0` occurs here
LL | *t1 = 22;
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
index 87135f0bb..934dd8df1 100644
--- a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
+++ b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
@@ -2,9 +2,8 @@ error[E0507]: cannot move out of an `Rc`
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14
|
LL | let _x = Rc::new(vec![1, 2]).into_iter();
- | ^^^^^^^^^^^^^^^^^^^^-----------
- | | |
- | | value moved due to this method call
+ | ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call
+ | |
| move occurs because value has type `Vec<i32>`, which does not implement the `Copy` trait
|
note: `into_iter` takes ownership of the receiver `self`, which moves value
@@ -12,7 +11,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves value
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | let _x = Rc::new(vec![1, 2]).clone().into_iter();
- | ++++++++
+ | ++++++++
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr b/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
index d2b845619..3653de0e8 100644
--- a/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
+++ b/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
@@ -5,9 +5,8 @@ LL | 1 => { addr.push(&mut x); }
| ^^^^^^ second mutable borrow occurs here
LL | 2 => { addr.push(&mut x); }
LL | _ => { addr.push(&mut x); }
- | -----------------
- | | |
- | | first mutable borrow occurs here
+ | ---- ------ first mutable borrow occurs here
+ | |
| first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
@@ -16,18 +15,16 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
LL | 2 => { addr.push(&mut x); }
| ^^^^^^ second mutable borrow occurs here
LL | _ => { addr.push(&mut x); }
- | -----------------
- | | |
- | | first mutable borrow occurs here
+ | ---- ------ first mutable borrow occurs here
+ | |
| first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-mut-borrow-linear-errors.rs:12:30
|
LL | _ => { addr.push(&mut x); }
- | ----------^^^^^^-
- | | |
- | | `x` was mutably borrowed here in the previous iteration of the loop
+ | ---- ^^^^^^ `x` was mutably borrowed here in the previous iteration of the loop
+ | |
| first borrow used here, in later iteration of loop
error: aborting due to 3 previous errors
diff --git a/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
index ef811b849..f2baee093 100644
--- a/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
+++ b/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
@@ -7,7 +7,7 @@ LL | let mut t2 = &mut t0;
| ^^^^^^^ mutable borrow occurs here
LL | **t2 += 1; // Mutates `*t0`
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `t0` as mutable more than once at a time
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18
@@ -18,7 +18,7 @@ LL | let mut t2 = &mut t0;
| ^^^^^^^ second mutable borrow occurs here
LL | **t2 += 1; // Mutates `*t0` but not through `*p`
LL | p.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-object-lifetime.stderr b/tests/ui/borrowck/borrowck-object-lifetime.stderr
index 215ed760a..cf94c74de 100644
--- a/tests/ui/borrowck/borrowck-object-lifetime.stderr
+++ b/tests/ui/borrowck/borrowck-object-lifetime.stderr
@@ -2,21 +2,21 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut
--> $DIR/borrowck-object-lifetime.rs:20:13
|
LL | let y = x.borrowed();
- | ------------ immutable borrow occurs here
+ | - immutable borrow occurs here
LL | let z = x.mut_borrowed();
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | y.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-object-lifetime.rs:26:13
|
LL | let y = x.borrowed();
- | ------------ immutable borrow occurs here
+ | - immutable borrow occurs here
LL | let z = &mut x;
| ^^^^^^ mutable borrow occurs here
LL | y.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
index fb7af50bc..2e7a6778d 100644
--- a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
+++ b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
@@ -6,7 +6,7 @@ LL | let p = &mut f[&s];
LL | let q = &f[&s];
| ^ immutable borrow occurs here
LL | p.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0499]: cannot borrow `*f` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:43:18
@@ -16,7 +16,7 @@ LL | let p = &mut f[&s];
LL | let q = &mut f[&s];
| ^ second mutable borrow occurs here
LL | p.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
@@ -26,7 +26,7 @@ LL | let p = &mut f.foo[&s];
LL | let q = &mut f.foo[&s];
| ^^^^^ second mutable borrow occurs here
LL | p.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-overloaded-index-autoderef.rs:65:18
@@ -36,7 +36,7 @@ LL | let p = &f.foo[&s];
LL | let q = &mut f.foo[&s];
| ^^^^^ mutable borrow occurs here
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
@@ -46,7 +46,7 @@ LL | let p = &f.foo[&s];
LL | f.foo = g;
| ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
@@ -56,7 +56,7 @@ LL | let p = &f.foo[&s];
LL | *f = g;
| ^^^^^^ `*f` is assigned to here but it was already borrowed
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
@@ -66,7 +66,7 @@ LL | let p = &mut f.foo[&s];
LL | f.foo = g;
| ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed
LL | p.use_mut();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
@@ -76,7 +76,7 @@ LL | let p = &mut f.foo[&s];
LL | *f = g;
| ^^^^^^ `*f` is assigned to here but it was already borrowed
LL | p.use_mut();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to 8 previous errors
diff --git a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
index d05996413..db73d4c04 100644
--- a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
+++ b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
@@ -8,7 +8,7 @@ LL | let z = &x;
| ^^ immutable borrow occurs here
...
LL | y.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
@@ -20,7 +20,7 @@ LL | let z = &mut x;
| ^^^^^^ mutable borrow occurs here
...
LL | y.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
@@ -32,7 +32,7 @@ LL | let z = &mut x;
| ^^^^^^ second mutable borrow occurs here
...
LL | y.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to 3 previous errors
diff --git a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
index b39215b9a..1c55953c9 100644
--- a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
+++ b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
@@ -7,7 +7,7 @@ LL | swap(&mut t0, &mut t1);
| ^^^^^^^ mutable borrow occurs here
LL | *t1 = 22;
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr
index a87a14e7c..f2e549cd8 100644
--- a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr
+++ b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr
@@ -6,7 +6,7 @@ LL | let ra = &mut u.s.a;
LL | let b = u.c;
| ^^^ use of borrowed `u.s.a`
LL | ra.use_mut();
- | ------------ borrow later used here
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-uniq-via-lend.stderr b/tests/ui/borrowck/borrowck-uniq-via-lend.stderr
index 6dbe4c74b..923edc8ed 100644
--- a/tests/ui/borrowck/borrowck-uniq-via-lend.stderr
+++ b/tests/ui/borrowck/borrowck-uniq-via-lend.stderr
@@ -6,7 +6,7 @@ LL | let w = &mut v;
LL | borrow(&*v);
| ^^^ immutable borrow occurs here
LL | w.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-uniq-via-lend.rs:53:12
@@ -16,7 +16,7 @@ LL | x = &mut v;
LL | borrow(&*v);
| ^^^ immutable borrow occurs here
LL | x.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
index eb0f24b9b..5141fcc1b 100644
--- a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
+++ b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
@@ -5,9 +5,8 @@ LL | let vb: &mut [isize] = &mut v;
| ------ first mutable borrow occurs here
...
LL | v.push(tail[0] + tail[1]);
- | ^^^^^^^-------^^^^^^^^^^^
- | | |
- | | first borrow later used here
+ | ^ ------- first borrow later used here
+ | |
| second mutable borrow occurs here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr
index 70b9e4f44..024cb006c 100644
--- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr
+++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr
@@ -8,7 +8,7 @@ LL | vec[0] = Box::new(4);
| ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
LL |
LL | _a.use_ref();
- | ------------ borrow later used here
+ | -- borrow later used here
error[E0506]: cannot assign to `vec[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
@@ -20,7 +20,7 @@ LL | vec[0] = Box::new(4);
| ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
LL |
LL | _b.use_ref();
- | ------------ borrow later used here
+ | -- borrow later used here
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:34:11
diff --git a/tests/ui/borrowck/clone-span-on-try-operator.fixed b/tests/ui/borrowck/clone-span-on-try-operator.fixed
new file mode 100644
index 000000000..52f66e43a
--- /dev/null
+++ b/tests/ui/borrowck/clone-span-on-try-operator.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#[derive(Clone)]
+struct Foo;
+impl Foo {
+ fn foo(self) {}
+}
+fn main() {
+ let foo = &Foo;
+ (*foo).clone().foo(); //~ ERROR cannot move out
+}
diff --git a/tests/ui/borrowck/clone-span-on-try-operator.rs b/tests/ui/borrowck/clone-span-on-try-operator.rs
new file mode 100644
index 000000000..031a35e20
--- /dev/null
+++ b/tests/ui/borrowck/clone-span-on-try-operator.rs
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#[derive(Clone)]
+struct Foo;
+impl Foo {
+ fn foo(self) {}
+}
+fn main() {
+ let foo = &Foo;
+ (*foo).foo(); //~ ERROR cannot move out
+}
diff --git a/tests/ui/borrowck/clone-span-on-try-operator.stderr b/tests/ui/borrowck/clone-span-on-try-operator.stderr
new file mode 100644
index 000000000..85785e670
--- /dev/null
+++ b/tests/ui/borrowck/clone-span-on-try-operator.stderr
@@ -0,0 +1,21 @@
+error[E0507]: cannot move out of `*foo` which is behind a shared reference
+ --> $DIR/clone-span-on-try-operator.rs:10:5
+ |
+LL | (*foo).foo();
+ | ^^^^^^ ----- `*foo` moved due to this method call
+ | |
+ | move occurs because `*foo` has type `Foo`, which does not implement the `Copy` trait
+ |
+note: `Foo::foo` takes ownership of the receiver `self`, which moves `*foo`
+ --> $DIR/clone-span-on-try-operator.rs:6:12
+ |
+LL | fn foo(self) {}
+ | ^^^^
+help: you can `clone` the value and consume it, but this might not be your desired behavior
+ |
+LL | (*foo).clone().foo();
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.rs b/tests/ui/borrowck/copy-suggestion-region-vid.rs
index dff952834..3c5b887ce 100644
--- a/tests/ui/borrowck/copy-suggestion-region-vid.rs
+++ b/tests/ui/borrowck/copy-suggestion-region-vid.rs
@@ -1,3 +1,4 @@
+//@run-rustfix
pub struct DataStruct();
pub struct HelperStruct<'n> {
diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.stderr b/tests/ui/borrowck/copy-suggestion-region-vid.stderr
index 1685acf87..b344aa664 100644
--- a/tests/ui/borrowck/copy-suggestion-region-vid.stderr
+++ b/tests/ui/borrowck/copy-suggestion-region-vid.stderr
@@ -1,13 +1,18 @@
error[E0382]: borrow of moved value: `helpers`
- --> $DIR/copy-suggestion-region-vid.rs:12:43
+ --> $DIR/copy-suggestion-region-vid.rs:13:43
|
LL | let helpers = [vec![], vec![]];
| ------- move occurs because `helpers` has type `[Vec<&i64>; 2]`, which does not implement the `Copy` trait
LL |
LL | HelperStruct { helpers, is_empty: helpers[0].is_empty() }
- | ------- ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move
+ | ------- ^^^^^^^^^^ value borrowed here after move
| |
| value moved here
+ |
+help: consider cloning the value if the performance cost is acceptable
+ |
+LL | HelperStruct { helpers: helpers.clone(), is_empty: helpers[0].is_empty() }
+ | +++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/borrowck/index-mut-help-with-impl.stderr b/tests/ui/borrowck/index-mut-help-with-impl.stderr
index 69dca7e7b..89391f409 100644
--- a/tests/ui/borrowck/index-mut-help-with-impl.stderr
+++ b/tests/ui/borrowck/index-mut-help-with-impl.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/index-mut-help-with-impl.rs:9:5
|
LL | Index::index(&v, 1..2).make_ascii_uppercase();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/tests/ui/borrowck/index-mut-help.stderr b/tests/ui/borrowck/index-mut-help.stderr
index f42d7e015..fde2b5dc0 100644
--- a/tests/ui/borrowck/index-mut-help.stderr
+++ b/tests/ui/borrowck/index-mut-help.stderr
@@ -2,13 +2,10 @@ error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutab
--> $DIR/index-mut-help.rs:10:5
|
LL | map["peter"].clear();
- | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^ cannot borrow as mutable
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
-help: to modify a `HashMap<&str, String>` use `.get_mut()`
- |
-LL | map.get_mut("peter").map(|val| val.clear());
- | ~~~~~~~~~ ~~~~~~~~~~~~~~~ +
+ = help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API
error[E0594]: cannot assign to data in an index of `HashMap<&str, String>`
--> $DIR/index-mut-help.rs:11:5
diff --git a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
index 25974e0d0..4e3bf1d70 100644
--- a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
+++ b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
@@ -26,9 +26,8 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time
--> $DIR/issue-109271-pass-self-into-closure.rs:21:12
|
LL | v.call(|(), this: &mut S| v.set());
- | -------^^^^^^^^^^^^^^^^^^---------
- | | | | |
- | | | | second borrow occurs due to use of `v` in closure
+ | - ---- ^^^^^^^^^^^^^^^^^^ - second borrow occurs due to use of `v` in closure
+ | | | |
| | | second mutable borrow occurs here
| | first borrow later used by call
| first mutable borrow occurs here
@@ -63,21 +62,14 @@ LL ~ S::get(&this);
error[E0499]: cannot borrow `v` as mutable more than once at a time
--> $DIR/issue-109271-pass-self-into-closure.rs:25:12
|
-LL | v.call(|(), this: &mut S| {
- | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | _____| first borrow later used by call
- | |
-LL | |
-LL | |
-LL | |
-LL | | _ = v;
-LL | | v.set();
- | | - second borrow occurs due to use of `v` in closure
-... |
-LL | | _ = v.add(3);
-LL | | });
- | |______- first mutable borrow occurs here
+LL | v.call(|(), this: &mut S| {
+ | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+...
+LL | v.set();
+ | - second borrow occurs due to use of `v` in closure
error: aborting due to 5 previous errors
diff --git a/tests/ui/borrowck/issue-42344.stderr b/tests/ui/borrowck/issue-42344.stderr
index 29b4c8c38..5cffa1b51 100644
--- a/tests/ui/borrowck/issue-42344.stderr
+++ b/tests/ui/borrowck/issue-42344.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable stati
--> $DIR/issue-42344.rs:4:5
|
LL | TAB[0].iter_mut();
- | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/tests/ui/borrowck/issue-47646.stderr b/tests/ui/borrowck/issue-47646.stderr
index 84cf9237a..d82e1f908 100644
--- a/tests/ui/borrowck/issue-47646.stderr
+++ b/tests/ui/borrowck/issue-47646.stderr
@@ -2,7 +2,7 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as m
--> $DIR/issue-47646.rs:9:30
|
LL | let borrow = heap.peek_mut();
- | --------------- mutable borrow occurs here
+ | ---- mutable borrow occurs here
LL |
LL | match (borrow, ()) {
| ------------ a temporary with access to the mutable borrow is created here ...
diff --git a/tests/ui/borrowck/issue-51117.stderr b/tests/ui/borrowck/issue-51117.stderr
index ef1a16ea9..f8a9608ad 100644
--- a/tests/ui/borrowck/issue-51117.stderr
+++ b/tests/ui/borrowck/issue-51117.stderr
@@ -4,7 +4,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time
LL | Some(baz) => {
| --- first mutable borrow occurs here
LL | bar.take();
- | ^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^ second mutable borrow occurs here
LL | drop(baz);
| --- first borrow later used here
diff --git a/tests/ui/borrowck/issue-81365-10.stderr b/tests/ui/borrowck/issue-81365-10.stderr
index d0986e9f9..2bbde82fa 100644
--- a/tests/ui/borrowck/issue-81365-10.stderr
+++ b/tests/ui/borrowck/issue-81365-10.stderr
@@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-10.rs:21:9
|
LL | let first = &self.deref().target_field;
- | ------------ `self.container_field` is borrowed here
+ | ---- `self.container_field` is borrowed here
LL | self.container_field = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
LL | first;
diff --git a/tests/ui/borrowck/issue-81365-5.stderr b/tests/ui/borrowck/issue-81365-5.stderr
index c00e48288..094cec021 100644
--- a/tests/ui/borrowck/issue-81365-5.stderr
+++ b/tests/ui/borrowck/issue-81365-5.stderr
@@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-5.rs:28:9
|
LL | let first = self.get();
- | ---------- `self.container_field` is borrowed here
+ | ---- `self.container_field` is borrowed here
LL | self.container_field = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
LL | first;
diff --git a/tests/ui/borrowck/issue-82032.stderr b/tests/ui/borrowck/issue-82032.stderr
index 25f343117..f272477a9 100644
--- a/tests/ui/borrowck/issue-82032.stderr
+++ b/tests/ui/borrowck/issue-82032.stderr
@@ -7,7 +7,7 @@ LL | for v in self.0.values() {
| | help: use mutable method: `values_mut()`
| this iterator yields `&` references
LL | v.flush();
- | ^^^^^^^^^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
diff --git a/tests/ui/borrowck/issue-85581.stderr b/tests/ui/borrowck/issue-85581.stderr
index 59ca4867f..29c0429f2 100644
--- a/tests/ui/borrowck/issue-85581.stderr
+++ b/tests/ui/borrowck/issue-85581.stderr
@@ -7,7 +7,7 @@ LL | match heap.peek_mut() {
| first mutable borrow occurs here
| a temporary with access to the first borrow is created here ...
LL | Some(_) => { heap.pop(); },
- | ^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^^ second mutable borrow occurs here
...
LL | }
| - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>`
diff --git a/tests/ui/borrowck/issue-85765-closure.rs b/tests/ui/borrowck/issue-85765-closure.rs
new file mode 100644
index 000000000..f2d1dd0fb
--- /dev/null
+++ b/tests/ui/borrowck/issue-85765-closure.rs
@@ -0,0 +1,31 @@
+fn main() {
+ let _ = || {
+ let mut test = Vec::new();
+ let rofl: &Vec<Vec<i32>> = &mut test;
+ //~^ HELP consider changing this binding's type
+ rofl.push(Vec::new());
+ //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference
+ //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+ let mut mutvar = 42;
+ let r = &mutvar;
+ //~^ HELP consider changing this to be a mutable reference
+ *r = 0;
+ //~^ ERROR cannot assign to `*r`, which is behind a `&` reference
+ //~| NOTE `r` is a `&` reference, so the data it refers to cannot be written
+
+ #[rustfmt::skip]
+ let x: &usize = &mut{0};
+ //~^ HELP consider changing this binding's type
+ *x = 1;
+ //~^ ERROR cannot assign to `*x`, which is behind a `&` reference
+ //~| NOTE `x` is a `&` reference, so the data it refers to cannot be written
+
+ #[rustfmt::skip]
+ let y: &usize = &mut(0);
+ //~^ HELP consider changing this binding's type
+ *y = 1;
+ //~^ ERROR cannot assign to `*y`, which is behind a `&` reference
+ //~| NOTE `y` is a `&` reference, so the data it refers to cannot be written
+ };
+}
diff --git a/tests/ui/borrowck/issue-85765-closure.stderr b/tests/ui/borrowck/issue-85765-closure.stderr
new file mode 100644
index 000000000..936ddd67b
--- /dev/null
+++ b/tests/ui/borrowck/issue-85765-closure.stderr
@@ -0,0 +1,48 @@
+error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:6:9
+ |
+LL | rofl.push(Vec::new());
+ | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ |
+help: consider changing this binding's type
+ |
+LL | let rofl: &mut Vec<Vec<i32>> = &mut test;
+ | ~~~~~~~~~~~~~~~~~~
+
+error[E0594]: cannot assign to `*r`, which is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:13:9
+ |
+LL | *r = 0;
+ | ^^^^^^ `r` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this to be a mutable reference
+ |
+LL | let r = &mut mutvar;
+ | +++
+
+error[E0594]: cannot assign to `*x`, which is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:20:9
+ |
+LL | *x = 1;
+ | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this binding's type
+ |
+LL | let x: &mut usize = &mut{0};
+ | ~~~~~~~~~~
+
+error[E0594]: cannot assign to `*y`, which is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:27:9
+ |
+LL | *y = 1;
+ | ^^^^^^ `y` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this binding's type
+ |
+LL | let y: &mut usize = &mut(0);
+ | ~~~~~~~~~~
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr
index 2985a658f..57900bfb6 100644
--- a/tests/ui/borrowck/issue-85765.stderr
+++ b/tests/ui/borrowck/issue-85765.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference
--> $DIR/issue-85765.rs:5:5
|
LL | rofl.push(Vec::new());
- | ^^^^^^^^^^^^^^^^^^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this binding's type
|
diff --git a/tests/ui/borrowck/issue-91206.stderr b/tests/ui/borrowck/issue-91206.stderr
index 6653d4978..30f836565 100644
--- a/tests/ui/borrowck/issue-91206.stderr
+++ b/tests/ui/borrowck/issue-91206.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*inner` as mutable, as it is behind a `&` reference
--> $DIR/issue-91206.rs:13:5
|
LL | inner.clear();
- | ^^^^^^^^^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider specifying this binding's type
|
diff --git a/tests/ui/borrowck/issue-93078.stderr b/tests/ui/borrowck/issue-93078.stderr
index 771a652a1..bcbcbe724 100644
--- a/tests/ui/borrowck/issue-93078.stderr
+++ b/tests/ui/borrowck/issue-93078.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
--> $DIR/issue-93078.rs:11:9
|
LL | self.modify();
- | ^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^ cannot borrow as mutable
|
= note: as `Self` may be unsized, this call attempts to take `&mut &mut self`
= note: however, `&mut self` expands to `self: &mut Self`, therefore `self` cannot be borrowed mutably
diff --git a/tests/ui/borrowck/many-mutable-borrows.stderr b/tests/ui/borrowck/many-mutable-borrows.stderr
index aa0cbcffd..0f808ac92 100644
--- a/tests/ui/borrowck/many-mutable-borrows.stderr
+++ b/tests/ui/borrowck/many-mutable-borrows.stderr
@@ -4,23 +4,23 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
LL | let v = Vec::new();
| ^ not mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
|
= note: ...and 5 other attempted mutable borrows
help: consider changing this to be mutable
diff --git a/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr b/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr
index c6f75b1c0..f448e009b 100644
--- a/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr
+++ b/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr
@@ -47,7 +47,7 @@ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
--> $DIR/mut-borrow-of-mut-ref.rs:34:5
|
LL | f.bar();
- | ^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider making the binding mutable
|
diff --git a/tests/ui/borrowck/mut-borrow-outside-loop.stderr b/tests/ui/borrowck/mut-borrow-outside-loop.stderr
index e6895b27f..4fcb693f1 100644
--- a/tests/ui/borrowck/mut-borrow-outside-loop.stderr
+++ b/tests/ui/borrowck/mut-borrow-outside-loop.stderr
@@ -6,7 +6,7 @@ LL | let first = &mut void;
LL | let second = &mut void;
| ^^^^^^^^^ second mutable borrow occurs here
LL | first.use_mut();
- | --------------- first borrow later used here
+ | ----- first borrow later used here
error[E0499]: cannot borrow `inner_void` as mutable more than once at a time
--> $DIR/mut-borrow-outside-loop.rs:15:28
@@ -17,7 +17,7 @@ LL | let inner_second = &mut inner_void;
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
LL | inner_second.use_mut();
LL | inner_first.use_mut();
- | --------------------- first borrow later used here
+ | ----------- first borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
index 4621d8793..bada08368 100644
--- a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
+++ b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
@@ -2,9 +2,8 @@ error[E0507]: cannot move out of `*cb` which is behind a mutable reference
--> $DIR/suggest-as-ref-on-mut-closure.rs:7:5
|
LL | cb.map(|cb| cb());
- | ^^^--------------
- | | |
- | | `*cb` moved due to this method call
+ | ^^ -------------- `*cb` moved due to this method call
+ | |
| help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
| move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait
|
diff --git a/tests/ui/borrowck/suggest-local-var-double-mut.stderr b/tests/ui/borrowck/suggest-local-var-double-mut.stderr
index 3a43c18a7..8bec0788f 100644
--- a/tests/ui/borrowck/suggest-local-var-double-mut.stderr
+++ b/tests/ui/borrowck/suggest-local-var-double-mut.stderr
@@ -2,9 +2,8 @@ error[E0499]: cannot borrow `*self` as mutable more than once at a time
--> $DIR/suggest-local-var-double-mut.rs:12:22
|
LL | self.foo(self.bar());
- | ---------^^^^^^^^^^-
- | | | |
- | | | second mutable borrow occurs here
+ | ---- --- ^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
|
diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr
index 615fffcd5..c8d00f7b2 100644
--- a/tests/ui/borrowck/suggest-local-var-for-vector.stderr
+++ b/tests/ui/borrowck/suggest-local-var-for-vector.stderr
@@ -2,11 +2,11 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu
--> $DIR/suggest-local-var-for-vector.rs:3:9
|
LL | vec[vec.len() - 1] = 123;
- | ----^^^^^^^^^-----
- | | |
- | | immutable borrow occurs here
+ | ----^^^-----------
+ | | ||
+ | | |immutable borrow occurs here
+ | | mutable borrow later used 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
@@ -14,10 +14,10 @@ help: try adding a local storing this...
LL | vec[vec.len() - 1] = 123;
| ^^^^^^^^^
help: ...and then using that local here
- --> $DIR/suggest-local-var-for-vector.rs:3:5
+ --> $DIR/suggest-local-var-for-vector.rs:3:8
|
LL | vec[vec.len() - 1] = 123;
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr b/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr
index eb934e7b7..1ef643e21 100644
--- a/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr
+++ b/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr
@@ -2,9 +2,8 @@ error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as im
--> $DIR/suggest-local-var-imm-and-mut.rs:12:22
|
LL | self.foo(self.bar());
- | ---------^^^^^^^^^^-
- | | | |
- | | | mutable borrow occurs here
+ | ---- --- ^^^^^^^^^^ mutable borrow occurs here
+ | | |
| | immutable borrow later used by call
| immutable borrow occurs here
diff --git a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr
index e3a16eddf..368d72810 100644
--- a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr
+++ b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr
@@ -2,11 +2,11 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu
--> $DIR/suggest-storing-local-var-for-vector.rs:3:9
|
LL | vec[vec.len() - 1] = 123;
- | ----^^^^^^^^^-----
- | | |
- | | immutable borrow occurs here
+ | ----^^^-----------
+ | | ||
+ | | |immutable borrow occurs here
+ | | mutable borrow later used here
| mutable borrow occurs here
- | mutable borrow later used here
|
help: try adding a local storing this...
--> $DIR/suggest-storing-local-var-for-vector.rs:3:9
@@ -14,10 +14,10 @@ help: try adding a local storing this...
LL | vec[vec.len() - 1] = 123;
| ^^^^^^^^^
help: ...and then using that local here
- --> $DIR/suggest-storing-local-var-for-vector.rs:3:5
+ --> $DIR/suggest-storing-local-var-for-vector.rs:3:8
|
LL | vec[vec.len() - 1] = 123;
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-across-loop.stderr b/tests/ui/borrowck/two-phase-across-loop.stderr
index 22f9b39df..d7c0210cc 100644
--- a/tests/ui/borrowck/two-phase-across-loop.stderr
+++ b/tests/ui/borrowck/two-phase-across-loop.stderr
@@ -2,9 +2,8 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time
--> $DIR/two-phase-across-loop.rs:17:22
|
LL | strings.push(foo.get_string());
- | -------------^^^^^^^^^^^^^^^^-
- | | |
- | | `foo` was mutably borrowed here in the previous iteration of the loop
+ | ------- ^^^ `foo` was mutably borrowed here in the previous iteration of the loop
+ | |
| first borrow used here, in later iteration of loop
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
index 21b0eddb9..2c3f1c18a 100644
--- a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
+++ b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
@@ -1,18 +1,13 @@
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-cannot-nest-mut-self-calls.rs:14:9
|
-LL | vec.get({
- | - --- immutable borrow later used by call
- | _____|
- | |
-LL | |
-LL | | vec.push(2);
- | | ^^^^^^^^^^^ mutable borrow occurs here
-LL | |
-LL | |
-LL | | 0
-LL | | });
- | |______- immutable borrow occurs here
+LL | vec.get({
+ | --- --- immutable borrow later used by call
+ | |
+ | immutable borrow occurs here
+LL |
+LL | vec.push(2);
+ | ^^^^^^^^^^^ mutable borrow occurs here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-multi-mut.stderr b/tests/ui/borrowck/two-phase-multi-mut.stderr
index 2e53e17a3..33fa4a3a1 100644
--- a/tests/ui/borrowck/two-phase-multi-mut.stderr
+++ b/tests/ui/borrowck/two-phase-multi-mut.stderr
@@ -12,9 +12,8 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time
--> $DIR/two-phase-multi-mut.rs:11:16
|
LL | foo.method(&mut foo);
- | -----------^^^^^^^^-
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------ ^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
diff --git a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
index efd63a08a..e122977b9 100644
--- a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
+++ b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
@@ -50,42 +50,42 @@ error[E0502]: cannot borrow `i` as immutable because it is also borrowed as muta
|
LL | i[i[3]] = 4;
| --^----
- | | |
- | | immutable borrow occurs here
+ | |||
+ | ||immutable borrow occurs here
+ | |mutable borrow later used here
| mutable borrow occurs here
- | mutable borrow later used here
|
help: try adding a local storing this...
- --> $DIR/two-phase-nonrecv-autoref.rs:132:7
+ --> $DIR/two-phase-nonrecv-autoref.rs:132:8
|
LL | i[i[3]] = 4;
- | ^^^^
+ | ^^^
help: ...and then using that local here
- --> $DIR/two-phase-nonrecv-autoref.rs:132:5
+ --> $DIR/two-phase-nonrecv-autoref.rs:132:6
|
LL | i[i[3]] = 4;
- | ^^^^^^^
+ | ^^^^^^
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-nonrecv-autoref.rs:138:7
|
LL | i[i[3]] = i[4];
| --^----
- | | |
- | | immutable borrow occurs here
+ | |||
+ | ||immutable borrow occurs here
+ | |mutable borrow later used here
| mutable borrow occurs here
- | mutable borrow later used here
|
help: try adding a local storing this...
- --> $DIR/two-phase-nonrecv-autoref.rs:138:7
+ --> $DIR/two-phase-nonrecv-autoref.rs:138:8
|
LL | i[i[3]] = i[4];
- | ^^^^
+ | ^^^
help: ...and then using that local here
- --> $DIR/two-phase-nonrecv-autoref.rs:138:5
+ --> $DIR/two-phase-nonrecv-autoref.rs:138:6
|
LL | i[i[3]] = i[4];
- | ^^^^^^^
+ | ^^^^^^
error: aborting due to 7 previous errors
diff --git a/tests/ui/borrowck/two-phase-sneaky.stderr b/tests/ui/borrowck/two-phase-sneaky.stderr
index 117d7ceae..4db970c1d 100644
--- a/tests/ui/borrowck/two-phase-sneaky.stderr
+++ b/tests/ui/borrowck/two-phase-sneaky.stderr
@@ -7,7 +7,7 @@ LL | v[0].push_str({
| first mutable borrow occurs here
LL |
LL | v.push(format!("foo"));
- | ^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | ^ second mutable borrow occurs here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
index e75094d4f..9f9d4bd8d 100644
--- a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
+++ b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
@@ -13,7 +13,7 @@ error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as im
--> $DIR/two-phase-surprise-no-conflict.rs:57:17
|
LL | self.hash_expr(&self.cx_mut.body(eid).value);
- | ^^^^^---------^^---------------------^^^^^^^
+ | ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^
| | | |
| | | immutable borrow occurs here
| | immutable borrow later used by call
@@ -23,9 +23,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:119:51
|
LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
- | ----------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -33,9 +32,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:122:54
|
LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | -------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -43,9 +41,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:125:53
|
LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | ------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -53,9 +50,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:128:44
|
LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
- | ---------------------------------------^^^^^^^^^^^^^^^^^--
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -106,9 +102,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:154:54
|
LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | -------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -129,9 +124,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:158:53
|
LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | ------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -149,9 +143,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:162:44
|
LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
- | ---------------------------------------^^^^^^^^^^^^^^^^^--
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
diff --git a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
index f033d53bf..a2f6365b7 100644
--- a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
+++ b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
@@ -15,7 +15,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `y`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | y.clone().into_iter();
- | ++++++++
+ | ++++++++
error: aborting due to previous error