summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/borrowck/anonymous-region-in-apit.rs12
-rw-r--r--src/test/ui/borrowck/anonymous-region-in-apit.stderr16
-rw-r--r--src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr30
-rw-r--r--src/test/ui/borrowck/borrowck-block-unint.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-break-uninit-2.stderr4
-rw-r--r--src/test/ui/borrowck/borrowck-break-uninit.stderr4
-rw-r--r--src/test/ui/borrowck/borrowck-describe-lvalue.stderr12
-rw-r--r--src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-init-in-fru.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-init-op-equal.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-init-plus-equal.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr6
-rw-r--r--src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr6
-rw-r--r--src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr10
-rw-r--r--src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr6
-rw-r--r--src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr20
-rw-r--r--src/test/ui/borrowck/borrowck-move-out-from-array.stderr16
-rw-r--r--src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-return.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr8
-rw-r--r--src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr8
-rw-r--r--src/test/ui/borrowck/borrowck-storage-dead.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-uninit-after-item.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-uninit-field-access.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr50
-rw-r--r--src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr15
-rw-r--r--src/test/ui/borrowck/borrowck-uninit.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr10
-rw-r--r--src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr5
-rw-r--r--src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr2
-rw-r--r--src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr2
-rw-r--r--src/test/ui/borrowck/borrowck-while-cond.stderr5
-rw-r--r--src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs8
-rw-r--r--src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr18
-rw-r--r--src/test/ui/borrowck/index-mut-help.rs3
-rw-r--r--src/test/ui/borrowck/index-mut-help.stderr19
-rw-r--r--src/test/ui/borrowck/issue-101119.rs16
-rw-r--r--src/test/ui/borrowck/issue-101119.stderr15
-rw-r--r--src/test/ui/borrowck/issue-102209.rs28
-rw-r--r--src/test/ui/borrowck/issue-102209.stderr22
-rw-r--r--src/test/ui/borrowck/issue-103250.rs37
-rw-r--r--src/test/ui/borrowck/issue-103250.stderr17
-rw-r--r--src/test/ui/borrowck/issue-103624.rs31
-rw-r--r--src/test/ui/borrowck/issue-103624.stderr35
-rw-r--r--src/test/ui/borrowck/issue-17718-static-move.rs (renamed from src/test/ui/issues/issue-17718-static-move.rs)0
-rw-r--r--src/test/ui/borrowck/issue-17718-static-move.stderr (renamed from src/test/ui/issues/issue-17718-static-move.stderr)0
-rw-r--r--src/test/ui/borrowck/issue-23338-params-outlive-temps-of-body.rs (renamed from src/test/ui/issues/issue-23338-params-outlive-temps-of-body.rs)0
-rw-r--r--src/test/ui/borrowck/issue-24267-flow-exit.stderr8
-rw-r--r--src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr4
-rw-r--r--src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr5
-rw-r--r--src/test/ui/borrowck/issue-64453.stderr1
-rw-r--r--src/test/ui/borrowck/issue-81899.rs3
-rw-r--r--src/test/ui/borrowck/issue-81899.stderr23
-rw-r--r--src/test/ui/borrowck/issue-88434-minimal-example.rs3
-rw-r--r--src/test/ui/borrowck/issue-88434-minimal-example.stderr23
-rw-r--r--src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs3
-rw-r--r--src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr23
-rw-r--r--src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs14
-rw-r--r--src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr37
-rw-r--r--src/test/ui/borrowck/reborrow-sugg-move-then-borrow.rs26
-rw-r--r--src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr24
-rw-r--r--src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr5
-rw-r--r--src/test/ui/borrowck/suggest-assign-rvalue.rs57
-rw-r--r--src/test/ui/borrowck/suggest-assign-rvalue.stderr138
-rw-r--r--src/test/ui/borrowck/two-phase-across-loop.stderr5
-rw-r--r--src/test/ui/borrowck/two-phase-nonrecv-autoref.rs4
-rw-r--r--src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs2
69 files changed, 831 insertions, 138 deletions
diff --git a/src/test/ui/borrowck/anonymous-region-in-apit.rs b/src/test/ui/borrowck/anonymous-region-in-apit.rs
new file mode 100644
index 000000000..7799a7cb1
--- /dev/null
+++ b/src/test/ui/borrowck/anonymous-region-in-apit.rs
@@ -0,0 +1,12 @@
+#![feature(anonymous_lifetime_in_impl_trait)]
+
+trait Foo<T> {
+ fn bar(self, baz: T);
+}
+
+fn qux(foo: impl Foo<&str>) {
+ |baz: &str| foo.bar(baz);
+ //~^ ERROR borrowed data escapes outside of closure
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/anonymous-region-in-apit.stderr b/src/test/ui/borrowck/anonymous-region-in-apit.stderr
new file mode 100644
index 000000000..9e100f8ac
--- /dev/null
+++ b/src/test/ui/borrowck/anonymous-region-in-apit.stderr
@@ -0,0 +1,16 @@
+error[E0521]: borrowed data escapes outside of closure
+ --> $DIR/anonymous-region-in-apit.rs:8:17
+ |
+LL | fn qux(foo: impl Foo<&str>) {
+ | --- lifetime `'2` appears in the type of `foo`
+LL | |baz: &str| foo.bar(baz);
+ | --- - ^^^^^^^^^^^^
+ | | | |
+ | | | `baz` escapes the closure body here
+ | | | argument requires that `'1` must outlive `'2`
+ | | let's call the lifetime of this reference `'1`
+ | `baz` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0521`.
diff --git a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr
index d4f819308..1fd1eb128 100644
--- a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr
+++ b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr
@@ -23,7 +23,7 @@ LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) {
| - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait
LL | match x {
LL | a @ [.., _] => (),
- | ----------- value moved here
+ | - value moved here
...
LL | &x;
| ^^ value borrowed here after move
@@ -32,7 +32,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:28:5
|
LL | ref mut foo @ [.., _] => Some(foo),
- | --------------------- mutable borrow occurs here
+ | ----------- mutable borrow occurs here
...
LL | &x;
| ^^ immutable borrow occurs here
@@ -44,7 +44,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:50:5
|
LL | [ref foo @ .., ref bar] => Some(foo),
- | ------------ immutable borrow occurs here
+ | ------- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -56,7 +56,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:62:5
|
LL | ref foo @ [.., ref bar] => Some(foo),
- | ----------------------- immutable borrow occurs here
+ | ------- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -71,7 +71,7 @@ LL | fn bindings_after_at_or_patterns_move(x: Option<Test>) {
| - move occurs because `x` has type `Option<Test>`, which does not implement the `Copy` trait
LL | match x {
LL | foo @ Some(Test::Foo | Test::Bar) => (),
- | ---------------------------------
+ | ---
| |
| value moved here
| value moved here
@@ -83,7 +83,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:86:5
|
LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo),
- | ------------------------------------- immutable borrow occurs here
+ | ------- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -95,7 +95,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:98:5
|
LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo),
- | ----------------------------------------- mutable borrow occurs here
+ | ----------- mutable borrow occurs here
...
LL | &x;
| ^^ immutable borrow occurs here
@@ -107,7 +107,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:112:5
|
LL | ref foo @ Some(box ref s) => Some(foo),
- | ------------------------- immutable borrow occurs here
+ | ------- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -122,7 +122,7 @@ LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option<Test>; 4])
| - move occurs because `x` has type `[Option<Test>; 4]`, which does not implement the `Copy` trait
LL | match x {
LL | a @ [.., Some(Test::Foo | Test::Bar)] => (),
- | -------------------------------------
+ | -
| |
| value moved here
| value moved here
@@ -134,7 +134,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:144:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a),
- | ------------------------------------------------- immutable borrow occurs here
+ | ----- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -146,7 +146,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:156:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b),
- | ---------- immutable borrow occurs here
+ | ----- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -158,7 +158,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:170:5
|
LL | [_, ref a @ Some(box ref b), ..] => Some(a),
- | ----------------------- immutable borrow occurs here
+ | ----- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -170,7 +170,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:186:5
|
LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
- | ------------------------------------------- immutable borrow occurs here
+ | ----- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
@@ -182,7 +182,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:200:5
|
LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
- | ----------------------------------------------- mutable borrow occurs here
+ | --------- mutable borrow occurs here
...
LL | &x;
| ^^ immutable borrow occurs here
@@ -194,7 +194,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:214:5
|
LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
- | ------------------------------------------------------------ immutable borrow occurs here
+ | ----- immutable borrow occurs here
...
LL | &mut x;
| ^^^^^^ mutable borrow occurs here
diff --git a/src/test/ui/borrowck/borrowck-block-unint.stderr b/src/test/ui/borrowck/borrowck-block-unint.stderr
index e720db1c6..f47921a97 100644
--- a/src/test/ui/borrowck/borrowck-block-unint.stderr
+++ b/src/test/ui/borrowck/borrowck-block-unint.stderr
@@ -7,6 +7,11 @@ LL | force(|| {
| ^^ `x` used here but it isn't initialized
LL | println!("{}", x);
| - borrow occurs due to use in closure
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
index 91038b3ad..ea93a8f40 100644
--- a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
+++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
@@ -8,6 +8,10 @@ LL | println!("{}", x);
| ^ `x` used here but it isn't initialized
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr
index 8d0c9582f..a7a8fc2ff 100644
--- a/src/test/ui/borrowck/borrowck-break-uninit.stderr
+++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr
@@ -8,6 +8,10 @@ LL | println!("{}", x);
| ^ `x` used here but it isn't initialized
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr
index f909dbc40..2c1b9c10d 100644
--- a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr
+++ b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr
@@ -36,6 +36,10 @@ LL | | }
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
+help: consider adding 'move' keyword before the nested closure
+ |
+LL | move || {
+ | ++++
error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:37:9
@@ -196,7 +200,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here
LL | match v {
LL | &[x @ ..] => println!("{:?}", x),
- | ^^^^^^ use of borrowed `v`
+ | ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
@@ -208,7 +212,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x @ ..] => println!("{:?}", x),
- | ^^^^^^ use of borrowed `v`
+ | ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
@@ -220,7 +224,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[x @ .., _] => println!("{:?}", x),
- | ^^^^^^ use of borrowed `v`
+ | ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
@@ -232,7 +236,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x @ .., _] => println!("{:?}", x),
- | ^^^^^^ use of borrowed `v`
+ | ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
diff --git a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr
index e8a2fbc91..1a22b5f09 100644
--- a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr
+++ b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr
@@ -5,6 +5,11 @@ LL | let i: isize;
| - binding declared here but left uninitialized
LL | i
| ^ `i` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let i: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr
index 1e950d6a2..f1b9b9aa7 100644
--- a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr
+++ b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr
@@ -5,6 +5,11 @@ LL | let i: isize;
| - binding declared here but left uninitialized
LL | i
| ^ `i` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let i: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.stderr
index 83a3e3e0e..39b28811a 100644
--- a/src/test/ui/borrowck/borrowck-init-in-fru.stderr
+++ b/src/test/ui/borrowck/borrowck-init-in-fru.stderr
@@ -5,6 +5,11 @@ LL | let mut origin: Point;
| ---------- binding declared here but left uninitialized
LL | origin = Point { x: 10, ..origin };
| ^^^^^^^^^^^^^^^^^^^^^^^^^ `origin.y` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let mut origin: Point = todo!();
+ | +++++++++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-init-op-equal.stderr b/src/test/ui/borrowck/borrowck-init-op-equal.stderr
index 74704b2ab..ef0fa6df4 100644
--- a/src/test/ui/borrowck/borrowck-init-op-equal.stderr
+++ b/src/test/ui/borrowck/borrowck-init-op-equal.stderr
@@ -5,6 +5,11 @@ LL | let v: isize;
| - binding declared here but left uninitialized
LL | v += 1;
| ^^^^^^ `v` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let v: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr
index 7542576d6..cec053318 100644
--- a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr
+++ b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr
@@ -5,6 +5,11 @@ LL | let mut v: isize;
| ----- binding declared here but left uninitialized
LL | v = v + 1;
| ^ `v` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let mut v: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr
index 3249aae8f..346b82a26 100644
--- a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr
@@ -79,7 +79,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array-match.rs:89:11
|
LL | [_y @ .., _, _] => {}
- | ------- value moved here
+ | -- value moved here
...
LL | [(_x, _), _, _] => {}
| ^^ value used here after move
@@ -90,7 +90,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array-match.rs:99:15
|
LL | [_, _, _y @ ..] => {}
- | ------- value moved here
+ | -- value moved here
...
LL | [.., (_x, _)] => {}
| ^^ value used here after move
@@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-match.rs:110:11
|
LL | [x @ .., _] => {}
- | ------ value partially moved here
+ | - value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr
index c19800226..6c6a25c25 100644
--- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr
@@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11
|
LL | [_, _y @ ..] => {}
- | ------- value partially moved here
+ | -- value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
@@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11
|
LL | [_y @ .., _] => {}
- | ------- value partially moved here
+ | -- value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
@@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11
|
LL | [x @ .., _, _] => {}
- | ------ value partially moved here
+ | - value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
index 8f2da9d20..77702e145 100644
--- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
@@ -79,7 +79,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use-match.rs:89:11
|
LL | [_y @ .., _, _] => {}
- | ------- value moved here
+ | -- value moved here
...
LL | [(ref _x, _), _, _] => {}
| ^^^^^^ value borrowed here after move
@@ -90,7 +90,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use-match.rs:99:15
|
LL | [_, _, _y @ ..] => {}
- | ------- value moved here
+ | -- value moved here
...
LL | [.., (ref _x, _)] => {}
| ^^^^^^ value borrowed here after move
@@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-match.rs:110:11
|
LL | [x @ .., _] => {}
- | ------ value partially moved here
+ | - value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
@@ -134,7 +134,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-match.rs:139:5
|
LL | [_, _, _x @ ..] => {}
- | ------- value partially moved here
+ | -- value partially moved here
LL | }
LL | a[0] = Default::default();
| ^^^^ value used here after partial move
@@ -145,7 +145,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-match.rs:147:5
|
LL | [_, _, _x @ ..] => {}
- | ------- value partially moved here
+ | -- value partially moved here
LL | }
LL | a[0].1 = Default::default();
| ^^^^ value used here after partial move
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr
index 4b27f03dc..6cc2c2f7a 100644
--- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr
@@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11
|
LL | [_, _y @ ..] => {}
- | ------- value partially moved here
+ | -- value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
@@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11
|
LL | [_y @ .., _] => {}
- | ------- value partially moved here
+ | -- value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
@@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11
|
LL | [x @ .., _, _] => {}
- | ------ value partially moved here
+ | - value partially moved here
LL | }
LL | match a {
| ^ value used here after partial move
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr
index b0bad6e99..9add7553a 100644
--- a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr
@@ -34,7 +34,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [_x, _, _] = a;
| -- value partially moved here
LL | let [ref _y @ .., _, _] = a;
- | ^^^^^^^^^^^ value borrowed here after partial move
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@@ -44,7 +44,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [.., _x] = a;
| -- value partially moved here
LL | let [_, _, ref _y @ ..] = a;
- | ^^^^^^^^^^^ value borrowed here after partial move
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@@ -54,7 +54,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [(_x, _), _, _] = a;
| -- value partially moved here
LL | let [ref _y @ .., _, _] = a;
- | ^^^^^^^^^^^ value borrowed here after partial move
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@@ -64,7 +64,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [.., (_x, _)] = a;
| -- value partially moved here
LL | let [_, _, ref _y @ ..] = a;
- | ^^^^^^^^^^^ value borrowed here after partial move
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@@ -72,7 +72,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use.rs:54:11
|
LL | let [_y @ .., _, _] = a;
- | ------- value moved here
+ | -- value moved here
LL | let [(ref _x, _), _, _] = a;
| ^^^^^^ value borrowed here after move
|
@@ -82,7 +82,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use.rs:60:15
|
LL | let [_, _, _y @ ..] = a;
- | ------- value moved here
+ | -- value moved here
LL | let [.., (ref _x, _)] = a;
| ^^^^^^ value borrowed here after move
|
@@ -92,9 +92,9 @@ error[E0382]: borrow of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use.rs:68:13
|
LL | let [x @ .., _] = a;
- | ------ value partially moved here
+ | - value partially moved here
LL | let [_, ref _y @ ..] = a;
- | ^^^^^^^^^^^ value borrowed here after partial move
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@@ -122,7 +122,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use.rs:88:5
|
LL | let [_, _, _x @ ..] = a;
- | ------- value partially moved here
+ | -- value partially moved here
LL | a[0] = Default::default();
| ^^^^ value used here after partial move
|
@@ -132,7 +132,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use.rs:94:5
|
LL | let [_, _, _x @ ..] = a;
- | ------- value partially moved here
+ | -- value partially moved here
LL | a[0].1 = Default::default();
| ^^^^ value used here after partial move
|
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr
index 1fc2b292b..363effcfe 100644
--- a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr
@@ -34,7 +34,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [_x, _, _] = a;
| -- value partially moved here
LL | let [_y @ .., _, _] = a;
- | ^^^^^^^ value used here after partial move
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@@ -44,7 +44,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [.., _x] = a;
| -- value partially moved here
LL | let [_, _, _y @ ..] = a;
- | ^^^^^^^ value used here after partial move
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@@ -54,7 +54,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [(_x, _), _, _] = a;
| -- value partially moved here
LL | let [_y @ .., _, _] = a;
- | ^^^^^^^ value used here after partial move
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@@ -64,7 +64,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [.., (_x, _)] = a;
| -- value partially moved here
LL | let [_, _, _y @ ..] = a;
- | ^^^^^^^ value used here after partial move
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@@ -72,7 +72,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array.rs:54:11
|
LL | let [_y @ .., _, _] = a;
- | ------- value moved here
+ | -- value moved here
LL | let [(_x, _), _, _] = a;
| ^^ value used here after move
|
@@ -82,7 +82,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array.rs:60:15
|
LL | let [_, _, _y @ ..] = a;
- | ------- value moved here
+ | -- value moved here
LL | let [.., (_x, _)] = a;
| ^^ value used here after move
|
@@ -92,9 +92,9 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array.rs:68:13
|
LL | let [x @ .., _] = a;
- | ------ value partially moved here
+ | - value partially moved here
LL | let [_, _y @ ..] = a;
- | ^^^^^^^ value used here after partial move
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
index 15ac73760..d2b845619 100644
--- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
@@ -25,7 +25,10 @@ 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/src/test/ui/borrowck/borrowck-return.stderr b/src/test/ui/borrowck/borrowck-return.stderr
index 1c916e223..9799357c9 100644
--- a/src/test/ui/borrowck/borrowck-return.stderr
+++ b/src/test/ui/borrowck/borrowck-return.stderr
@@ -5,6 +5,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | return x;
| ^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr
index b8ac7a3a4..f4324110c 100644
--- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr
+++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr
@@ -57,7 +57,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | let [ref first, ref second, ..] = *s;
| ---------- immutable borrow occurs here
LL | let [_, ref mut tail @ ..] = *s;
- | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]);
| ------ immutable borrow later used here
@@ -67,7 +67,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | let [.., ref second, ref first] = *s;
| ---------- immutable borrow occurs here
LL | let [ref mut tail @ .., _] = *s;
- | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]);
| ------ immutable borrow later used here
@@ -75,9 +75,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10
|
LL | let [_, ref s1 @ ..] = *s;
- | ----------- immutable borrow occurs here
+ | ------ immutable borrow occurs here
LL | let [ref mut s2 @ .., _, _] = *s;
- | ^^^^^^^^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^ mutable borrow occurs here
LL | nop_subslice(s1);
| -- immutable borrow later used here
diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr
index d3388e071..f9a63bd49 100644
--- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr
+++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr
@@ -88,7 +88,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | if let [ref first, ref second, ..] = *s {
| ---------- immutable borrow occurs here
LL | if let [_, ref mut tail @ ..] = *s {
- | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]);
| ------ immutable borrow later used here
@@ -98,7 +98,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | if let [.., ref second, ref first] = *s {
| ---------- immutable borrow occurs here
LL | if let [ref mut tail @ .., _] = *s {
- | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]);
| ------ immutable borrow later used here
@@ -106,9 +106,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:65:17
|
LL | if let [_, _, _, ref s1 @ ..] = *s {
- | ----------- immutable borrow occurs here
+ | ------ immutable borrow occurs here
LL | if let [ref mut s2 @ .., _, _, _] = *s {
- | ^^^^^^^^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^ mutable borrow occurs here
LL | nop_subslice(s1);
| -- immutable borrow later used here
diff --git a/src/test/ui/borrowck/borrowck-storage-dead.stderr b/src/test/ui/borrowck/borrowck-storage-dead.stderr
index 2cea4392d..3a413153a 100644
--- a/src/test/ui/borrowck/borrowck-storage-dead.stderr
+++ b/src/test/ui/borrowck/borrowck-storage-dead.stderr
@@ -5,6 +5,11 @@ LL | let x: i32;
| - binding declared here but left uninitialized
LL | let _ = x + 1;
| ^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: i32 = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr
index 588b1b0c9..071598b42 100644
--- a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr
+++ b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr
@@ -6,6 +6,11 @@ LL | let bar;
LL | fn baz(_x: isize) { }
LL | baz(bar);
| ^^^ `bar` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let bar = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr
index 6a38a7989..f0f4ad704 100644
--- a/src/test/ui/borrowck/borrowck-uninit-field-access.stderr
+++ b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr
@@ -5,6 +5,11 @@ LL | let mut a: Point;
| ----- binding declared here but left uninitialized
LL | let _ = a.x + 1;
| ^^^ `a.x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let mut a: Point = Default::default();
+ | ++++++++++++++++++++
error[E0382]: use of moved value: `line1.origin`
--> $DIR/borrowck-uninit-field-access.rs:25:13
diff --git a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr
index 744cb14e6..fdbb451bd 100644
--- a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr
+++ b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr
@@ -5,6 +5,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x += 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:9:5
@@ -13,6 +18,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x -= 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:12:5
@@ -21,6 +31,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x *= 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:15:5
@@ -29,6 +44,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x /= 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:18:5
@@ -37,6 +57,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x %= 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:21:5
@@ -45,6 +70,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x ^= 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:24:5
@@ -53,6 +83,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x &= 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:27:5
@@ -61,6 +96,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x |= 1;
| ^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:30:5
@@ -69,6 +109,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x <<= 1;
| ^^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-in-assignop.rs:33:5
@@ -77,6 +122,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | x >>= 1;
| ^^^^^^^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error: aborting due to 10 previous errors
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr
index c486cb6dd..73fded754 100644
--- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr
+++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr
@@ -5,6 +5,11 @@ LL | let x: &&Box<i32>;
| - binding declared here but left uninitialized
LL | let _y = &**x;
| ^^^^ `**x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: &&Box<i32> = todo!();
+ | +++++++++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-ref-chain.rs:11:14
@@ -13,6 +18,11 @@ LL | let x: &&S<i32, i32>;
| - binding declared here but left uninitialized
LL | let _y = &**x;
| ^^^^ `**x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: &&S<i32, i32> = todo!();
+ | +++++++++
error[E0381]: used binding `x` isn't initialized
--> $DIR/borrowck-uninit-ref-chain.rs:14:14
@@ -21,6 +31,11 @@ LL | let x: &&i32;
| - binding declared here but left uninitialized
LL | let _y = &**x;
| ^^^^ `**x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: &&i32 = todo!();
+ | +++++++++
error[E0381]: partially assigned binding `a` isn't fully initialized
--> $DIR/borrowck-uninit-ref-chain.rs:18:5
diff --git a/src/test/ui/borrowck/borrowck-uninit.stderr b/src/test/ui/borrowck/borrowck-uninit.stderr
index d5566691a..eeafc4ce1 100644
--- a/src/test/ui/borrowck/borrowck-uninit.stderr
+++ b/src/test/ui/borrowck/borrowck-uninit.stderr
@@ -5,6 +5,11 @@ LL | let x: isize;
| - binding declared here but left uninitialized
LL | foo(x);
| ^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: isize = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr
index 459cf1398..18e808f10 100644
--- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr
+++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr
@@ -5,6 +5,11 @@ LL | let w: &mut [isize];
| - binding declared here but left uninitialized
LL | w[5] = 0;
| ^^^^ `*w` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let w: &mut [isize] = todo!();
+ | +++++++++
error[E0381]: used binding `w` isn't initialized
--> $DIR/borrowck-use-in-index-lvalue.rs:6:5
@@ -13,6 +18,11 @@ LL | let mut w: &mut [isize];
| ----- binding declared here but left uninitialized
LL | w[5] = 0;
| ^^^^ `*w` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let mut w: &mut [isize] = todo!();
+ | +++++++++
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr
index 942ed4fc6..55f3ff553 100644
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr
@@ -5,6 +5,11 @@ LL | let x: &i32;
| - binding declared here but left uninitialized
LL | let y = x as *const dyn Foo;
| ^ `*x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: &i32 = todo!();
+ | +++++++++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr
index f3289e239..ea3d0d3ef 100644
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr
@@ -5,6 +5,11 @@ LL | let x: &i32;
| - binding declared here but left uninitialized
LL | let y = x as *const i32;
| ^ `*x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: &i32 = todo!();
+ | +++++++++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr
index ff70ba9fc..0ac7df944 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr
@@ -2,7 +2,7 @@ error[E0506]: cannot assign to `a[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-move-tail.rs:8:5
|
LL | [1, 2, ref tail @ ..] => tail,
- | ------------- borrow of `a[_]` occurs here
+ | -------- borrow of `a[_]` occurs here
...
LL | a[2] = 0;
| ^^^^^^^^ assignment to borrowed `a[_]` occurs here
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
index ddd89afe5..c3bcb7de6 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
@@ -14,7 +14,7 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
|
LL | &mut [ref _b @ ..] => {
- | ----------- borrow of `vec[_]` occurs here
+ | ------ borrow of `vec[_]` occurs here
LL |
LL | vec[0] = Box::new(4);
| ^^^^^^ assignment to borrowed `vec[_]` occurs here
diff --git a/src/test/ui/borrowck/borrowck-while-cond.stderr b/src/test/ui/borrowck/borrowck-while-cond.stderr
index e41c1c55e..5d0194989 100644
--- a/src/test/ui/borrowck/borrowck-while-cond.stderr
+++ b/src/test/ui/borrowck/borrowck-while-cond.stderr
@@ -5,6 +5,11 @@ LL | let x: bool;
| - binding declared here but left uninitialized
LL | while x { }
| ^ `x` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let x: bool = false;
+ | +++++++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs
new file mode 100644
index 000000000..524459291
--- /dev/null
+++ b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs
@@ -0,0 +1,8 @@
+fn main() {
+ let mut vec: Vec<i32> = Vec::new();
+ let closure = move || {
+ vec.clear();
+ let mut iter = vec.iter();
+ move || { iter.next() } //~ ERROR captured variable cannot escape `FnMut` closure bod
+ };
+}
diff --git a/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr
new file mode 100644
index 000000000..78ca090fe
--- /dev/null
+++ b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr
@@ -0,0 +1,18 @@
+error: captured variable cannot escape `FnMut` closure body
+ --> $DIR/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs:6:9
+ |
+LL | let mut vec: Vec<i32> = Vec::new();
+ | ------- variable defined here
+LL | let closure = move || {
+ | - inferred to be a `FnMut` closure
+LL | vec.clear();
+ | --- variable captured here
+LL | let mut iter = vec.iter();
+LL | move || { iter.next() }
+ | ^^^^^^^^^^^^^^^^^^^^^^^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+ |
+ = note: `FnMut` closures only have access to their captured variables while they are executing...
+ = note: ...therefore, they cannot allow references to captured variables to escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/index-mut-help.rs b/src/test/ui/borrowck/index-mut-help.rs
index d57ef975d..35266e113 100644
--- a/src/test/ui/borrowck/index-mut-help.rs
+++ b/src/test/ui/borrowck/index-mut-help.rs
@@ -1,10 +1,9 @@
// When mutably indexing a type that implements `Index` but not `IndexMut`, a
// special 'help' message is added to the output.
+use std::collections::HashMap;
fn main() {
- use std::collections::HashMap;
-
let mut map = HashMap::new();
map.insert("peter", "23".to_string());
diff --git a/src/test/ui/borrowck/index-mut-help.stderr b/src/test/ui/borrowck/index-mut-help.stderr
index 057c6ee15..f42d7e015 100644
--- a/src/test/ui/borrowck/index-mut-help.stderr
+++ b/src/test/ui/borrowck/index-mut-help.stderr
@@ -1,26 +1,39 @@
error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable
- --> $DIR/index-mut-help.rs:11:5
+ --> $DIR/index-mut-help.rs:10:5
|
LL | map["peter"].clear();
| ^^^^^^^^^^^^^^^^^^^^ 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());
+ | ~~~~~~~~~ ~~~~~~~~~~~~~~~ +
error[E0594]: cannot assign to data in an index of `HashMap<&str, String>`
- --> $DIR/index-mut-help.rs:12:5
+ --> $DIR/index-mut-help.rs:11:5
|
LL | map["peter"] = "0".to_string();
| ^^^^^^^^^^^^ cannot assign
|
= 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()`, `.insert()` or the entry API
+ |
+LL | map.insert("peter", "0".to_string());
+ | ~~~~~~~~ ~ +
+LL | map.get_mut("peter").map(|val| { *val = "0".to_string(); });
+ | ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ++++
+LL | let val = map.entry("peter").or_insert("0".to_string());
+ | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ +
error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable
- --> $DIR/index-mut-help.rs:13:13
+ --> $DIR/index-mut-help.rs:12:13
|
LL | let _ = &mut map["peter"];
| ^^^^^^^^^^^^^^^^^ 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()`, `.insert()` or the entry API
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/issue-101119.rs b/src/test/ui/borrowck/issue-101119.rs
new file mode 100644
index 000000000..64e52eaac
--- /dev/null
+++ b/src/test/ui/borrowck/issue-101119.rs
@@ -0,0 +1,16 @@
+struct State;
+
+fn once(_: impl FnOnce()) {}
+
+fn fill_memory_blocks_mt(state: &mut State) {
+ loop {
+ once(move || {
+ //~^ ERROR use of moved value: `state`
+ fill_segment(state);
+ });
+ }
+}
+
+fn fill_segment(_: &mut State) {}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/issue-101119.stderr b/src/test/ui/borrowck/issue-101119.stderr
new file mode 100644
index 000000000..a22afdc67
--- /dev/null
+++ b/src/test/ui/borrowck/issue-101119.stderr
@@ -0,0 +1,15 @@
+error[E0382]: use of moved value: `state`
+ --> $DIR/issue-101119.rs:7:14
+ |
+LL | fn fill_memory_blocks_mt(state: &mut State) {
+ | ----- move occurs because `state` has type `&mut State`, which does not implement the `Copy` trait
+LL | loop {
+LL | once(move || {
+ | ^^^^^^^ value moved into closure here, in previous iteration of loop
+LL |
+LL | fill_segment(state);
+ | ----- use occurs due to use in closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/issue-102209.rs b/src/test/ui/borrowck/issue-102209.rs
new file mode 100644
index 000000000..37628bff7
--- /dev/null
+++ b/src/test/ui/borrowck/issue-102209.rs
@@ -0,0 +1,28 @@
+use std::marker::PhantomData;
+
+pub struct NfaBuilder<'brand> {
+ brand: PhantomData<&'brand mut &'brand mut ()>,
+}
+
+impl NfaBuilder<'_> {
+ pub fn with<R, F: FnOnce(NfaBuilder<'_>) -> R>(f: F) -> R {
+ Brand::with(|brand| {
+ f(Self { brand: brand.lt })
+ //~^ ERROR lifetime may not live long enough
+ //~| ERROR lifetime may not live long enough
+ })
+ }
+}
+
+#[derive(Clone, Copy)]
+pub struct Brand<'brand> {
+ lt: PhantomData<&'brand mut &'brand mut ()>,
+}
+
+impl Brand<'_> {
+ pub fn with<R, F: FnOnce(Brand<'_>) -> R>(f: F) -> R {
+ f(Self { lt: PhantomData })
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/issue-102209.stderr b/src/test/ui/borrowck/issue-102209.stderr
new file mode 100644
index 000000000..351de8217
--- /dev/null
+++ b/src/test/ui/borrowck/issue-102209.stderr
@@ -0,0 +1,22 @@
+error: lifetime may not live long enough
+ --> $DIR/issue-102209.rs:10:29
+ |
+LL | impl NfaBuilder<'_> {
+ | -- lifetime `'2` appears in the `impl`'s self type
+LL | pub fn with<R, F: FnOnce(NfaBuilder<'_>) -> R>(f: F) -> R {
+LL | Brand::with(|brand| {
+ | ----- has type `Brand<'1>`
+LL | f(Self { brand: brand.lt })
+ | ^^^^^^^^ this usage requires that `'1` must outlive `'2`
+
+error: lifetime may not live long enough
+ --> $DIR/issue-102209.rs:10:29
+ |
+LL | impl NfaBuilder<'_> {
+ | -- lifetime `'1` appears in the `impl`'s self type
+...
+LL | f(Self { brand: brand.lt })
+ | ^^^^^^^^ this usage requires that `'1` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/borrowck/issue-103250.rs b/src/test/ui/borrowck/issue-103250.rs
new file mode 100644
index 000000000..46565f61c
--- /dev/null
+++ b/src/test/ui/borrowck/issue-103250.rs
@@ -0,0 +1,37 @@
+// edition:2021
+
+type TranslateFn = Box<dyn Fn(String, String) -> String>;
+
+pub struct DeviceCluster {
+ devices: Vec<Device>,
+}
+
+impl DeviceCluster {
+ pub async fn do_something(&mut self) -> Result<String, Box<dyn std::error::Error>> {
+ let mut last_error: Box<dyn std::error::Error>;
+
+ for device in &mut self.devices {
+ match device.do_something().await {
+ Ok(info) => {
+ return Ok(info);
+ }
+ Err(e) => {}
+ }
+ }
+
+ Err(last_error)
+ //~^ ERROR used binding `last_error` isn't initialized
+ }
+}
+
+pub struct Device {
+ translate_fn: Option<TranslateFn>,
+}
+
+impl Device {
+ pub async fn do_something(&mut self) -> Result<String, Box<dyn std::error::Error>> {
+ Ok(String::from(""))
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/issue-103250.stderr b/src/test/ui/borrowck/issue-103250.stderr
new file mode 100644
index 000000000..4a2378352
--- /dev/null
+++ b/src/test/ui/borrowck/issue-103250.stderr
@@ -0,0 +1,17 @@
+error[E0381]: used binding `last_error` isn't initialized
+ --> $DIR/issue-103250.rs:22:13
+ |
+LL | let mut last_error: Box<dyn std::error::Error>;
+ | -------------- binding declared here but left uninitialized
+...
+LL | Err(last_error)
+ | ^^^^^^^^^^ `last_error` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let mut last_error: Box<dyn std::error::Error> = todo!();
+ | +++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/issue-103624.rs b/src/test/ui/borrowck/issue-103624.rs
new file mode 100644
index 000000000..f1fa95f92
--- /dev/null
+++ b/src/test/ui/borrowck/issue-103624.rs
@@ -0,0 +1,31 @@
+// edition:2021
+
+struct StructA {
+ b: StructB,
+}
+
+async fn spawn_blocking<T>(f: impl (Fn() -> T) + Send + Sync + 'static) -> T {
+ todo!()
+}
+
+impl StructA {
+ async fn foo(&self) {
+ let bar = self.b.bar().await;
+ spawn_blocking(move || {
+ //~^ ERROR borrowed data escapes outside of associated function
+ self.b;
+ //~^ ERROR cannot move out of `self.b`, as `self` is a captured variable in an `Fn` closure
+ })
+ .await;
+ }
+}
+
+struct StructB {}
+
+impl StructB {
+ async fn bar(&self) -> Option<u8> {
+ None
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/issue-103624.stderr b/src/test/ui/borrowck/issue-103624.stderr
new file mode 100644
index 000000000..e6a35dd88
--- /dev/null
+++ b/src/test/ui/borrowck/issue-103624.stderr
@@ -0,0 +1,35 @@
+error[E0507]: cannot move out of `self.b`, as `self` is a captured variable in an `Fn` closure
+ --> $DIR/issue-103624.rs:16:13
+ |
+LL | async fn foo(&self) {
+ | ----- captured outer variable
+LL | let bar = self.b.bar().await;
+LL | spawn_blocking(move || {
+ | ------- captured by this `Fn` closure
+LL |
+LL | self.b;
+ | ^^^^^^ move occurs because `self.b` has type `StructB`, which does not implement the `Copy` trait
+
+error[E0521]: borrowed data escapes outside of associated function
+ --> $DIR/issue-103624.rs:14:9
+ |
+LL | async fn foo(&self) {
+ | -----
+ | |
+ | `self` is a reference that is only valid in the associated function body
+ | let's call the lifetime of this reference `'1`
+LL | let bar = self.b.bar().await;
+LL | / spawn_blocking(move || {
+LL | |
+LL | | self.b;
+LL | |
+LL | | })
+ | | ^
+ | | |
+ | |__________`self` escapes the associated function body here
+ | argument requires that `'1` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0507, E0521.
+For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issues/issue-17718-static-move.rs b/src/test/ui/borrowck/issue-17718-static-move.rs
index 015487a06..015487a06 100644
--- a/src/test/ui/issues/issue-17718-static-move.rs
+++ b/src/test/ui/borrowck/issue-17718-static-move.rs
diff --git a/src/test/ui/issues/issue-17718-static-move.stderr b/src/test/ui/borrowck/issue-17718-static-move.stderr
index 984534bfb..984534bfb 100644
--- a/src/test/ui/issues/issue-17718-static-move.stderr
+++ b/src/test/ui/borrowck/issue-17718-static-move.stderr
diff --git a/src/test/ui/issues/issue-23338-params-outlive-temps-of-body.rs b/src/test/ui/borrowck/issue-23338-params-outlive-temps-of-body.rs
index d45aaa843..d45aaa843 100644
--- a/src/test/ui/issues/issue-23338-params-outlive-temps-of-body.rs
+++ b/src/test/ui/borrowck/issue-23338-params-outlive-temps-of-body.rs
diff --git a/src/test/ui/borrowck/issue-24267-flow-exit.stderr b/src/test/ui/borrowck/issue-24267-flow-exit.stderr
index b85e8f216..58d1c8c0f 100644
--- a/src/test/ui/borrowck/issue-24267-flow-exit.stderr
+++ b/src/test/ui/borrowck/issue-24267-flow-exit.stderr
@@ -8,6 +8,10 @@ LL | println!("{}", x);
| ^ `x` used here but it isn't initialized
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let x: i32 = 0;
+ | +++
error[E0381]: used binding `x` isn't initialized
--> $DIR/issue-24267-flow-exit.rs:18:20
@@ -19,6 +23,10 @@ LL | println!("{}", x);
| ^ `x` used here but it isn't initialized
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let x: i32 = 0;
+ | +++
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
index d98b3bae4..f0b574846 100644
--- a/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
+++ b/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
@@ -10,6 +10,10 @@ LL | || f() // The `nested` closure
| ^^^^^^ returning this value requires that `'1` must outlive `'2`
|
= note: closure implements `Fn`, so references to captured variables can't escape the closure
+help: consider adding 'move' keyword before the nested closure
+ |
+LL | move || f() // The `nested` closure
+ | ++++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr b/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr
index f5d2eecfa..9683da919 100644
--- a/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr
+++ b/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr
@@ -5,6 +5,11 @@ LL | let e: i32;
| - binding declared here but left uninitialized
LL | match e {
| ^ `e` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let e: i32 = 0;
+ | +++
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/issue-64453.stderr b/src/test/ui/borrowck/issue-64453.stderr
index 1f8a1acb8..245c3a40e 100644
--- a/src/test/ui/borrowck/issue-64453.stderr
+++ b/src/test/ui/borrowck/issue-64453.stderr
@@ -14,6 +14,7 @@ LL | static settings_dir: String = format!("");
| ^^^^^^^^^^^
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
+ = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0507]: cannot move out of static item `settings_dir`
diff --git a/src/test/ui/borrowck/issue-81899.rs b/src/test/ui/borrowck/issue-81899.rs
index 9b6061203..24b20b650 100644
--- a/src/test/ui/borrowck/issue-81899.rs
+++ b/src/test/ui/borrowck/issue-81899.rs
@@ -2,8 +2,7 @@
// The `panic!()` below is important to trigger the fixed ICE.
const _CONST: &[u8] = &f(&[], |_| {});
-//~^ ERROR any use of this value
-//~| WARNING this was previously
+//~^ ERROR constant
const fn f<F>(_: &[u8], _: F) -> &[u8]
where
diff --git a/src/test/ui/borrowck/issue-81899.stderr b/src/test/ui/borrowck/issue-81899.stderr
index fd591c7b5..12e80b9df 100644
--- a/src/test/ui/borrowck/issue-81899.stderr
+++ b/src/test/ui/borrowck/issue-81899.stderr
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/issue-81899.rs:12:5
+ --> $DIR/issue-81899.rs:11:5
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24
@@ -7,32 +7,17 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
LL | panic!()
| ^^^^^^^^
| |
- | the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:12:5
+ | the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
--> $DIR/issue-81899.rs:4:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
- | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
- |
- = note: `#[deny(const_err)]` on by default
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+ | ^^^^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
-Future incompatibility report: Future breakage diagnostic:
-error: any use of this value will cause an error
- --> $DIR/issue-81899.rs:4:23
- |
-LL | const _CONST: &[u8] = &f(&[], |_| {});
- | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
- |
- = note: `#[deny(const_err)]` on by default
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
-
diff --git a/src/test/ui/borrowck/issue-88434-minimal-example.rs b/src/test/ui/borrowck/issue-88434-minimal-example.rs
index 7618d001e..983a02310 100644
--- a/src/test/ui/borrowck/issue-88434-minimal-example.rs
+++ b/src/test/ui/borrowck/issue-88434-minimal-example.rs
@@ -1,8 +1,7 @@
// Regression test related to issue 88434
const _CONST: &() = &f(&|_| {});
-//~^ ERROR any use of this value
-//~| WARNING this was previously
+//~^ ERROR constant
const fn f<F>(_: &F)
where
diff --git a/src/test/ui/borrowck/issue-88434-minimal-example.stderr b/src/test/ui/borrowck/issue-88434-minimal-example.stderr
index a3582e780..dc87c4c2b 100644
--- a/src/test/ui/borrowck/issue-88434-minimal-example.stderr
+++ b/src/test/ui/borrowck/issue-88434-minimal-example.stderr
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/issue-88434-minimal-example.rs:11:5
+ --> $DIR/issue-88434-minimal-example.rs:10:5
|
LL | const _CONST: &() = &f(&|_| {});
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
@@ -7,32 +7,17 @@ LL | const _CONST: &() = &f(&|_| {});
LL | panic!()
| ^^^^^^^^
| |
- | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:11:5
+ | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-minimal-example.rs:3:21
|
LL | const _CONST: &() = &f(&|_| {});
- | ----------------- ^^^^^^^^^^^ referenced constant has errors
- |
- = note: `#[deny(const_err)]` on by default
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+ | ^^^^^^^^^^^ referenced constant has errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
-Future incompatibility report: Future breakage diagnostic:
-error: any use of this value will cause an error
- --> $DIR/issue-88434-minimal-example.rs:3:21
- |
-LL | const _CONST: &() = &f(&|_| {});
- | ----------------- ^^^^^^^^^^^ referenced constant has errors
- |
- = note: `#[deny(const_err)]` on by default
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
-
diff --git a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs
index b1fc1615e..a99c5b76a 100644
--- a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs
+++ b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs
@@ -1,8 +1,7 @@
// Regression test for issue 88434
const _CONST: &[u8] = &f(&[], |_| {});
-//~^ ERROR any use of this value will cause an error
-//~| WARNING this was previously
+//~^ ERROR constant
const fn f<F>(_: &[u8], _: F) -> &[u8]
where
diff --git a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
index a6c65b302..4b4a25d7b 100644
--- a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
+++ b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/issue-88434-removal-index-should-be-less.rs:11:5
+ --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
@@ -7,32 +7,17 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
LL | panic!()
| ^^^^^^^^
| |
- | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:11:5
+ | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
- | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
- |
- = note: `#[deny(const_err)]` on by default
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+ | ^^^^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
-Future incompatibility report: Future breakage diagnostic:
-error: any use of this value will cause an error
- --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
- |
-LL | const _CONST: &[u8] = &f(&[], |_| {});
- | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors
- |
- = note: `#[deny(const_err)]` on by default
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
-
diff --git a/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs
new file mode 100644
index 000000000..95847d8d3
--- /dev/null
+++ b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs
@@ -0,0 +1,14 @@
+fn foo1(s: &str) -> impl Iterator<Item = String> + '_ {
+ None.into_iter()
+ .flat_map(move |()| s.chars().map(|c| format!("{}{}", c, s)))
+ //~^ ERROR captured variable cannot escape `FnMut` closure body
+ //~| HELP consider adding 'move' keyword before the nested closure
+}
+
+fn foo2(s: &str) -> impl Sized + '_ {
+ move |()| s.chars().map(|c| format!("{}{}", c, s))
+ //~^ ERROR lifetime may not live long enough
+ //~| HELP consider adding 'move' keyword before the nested closure
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
new file mode 100644
index 000000000..2eae614a2
--- /dev/null
+++ b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
@@ -0,0 +1,37 @@
+error: captured variable cannot escape `FnMut` closure body
+ --> $DIR/issue-95079-missing-move-in-nested-closure.rs:3:29
+ |
+LL | fn foo1(s: &str) -> impl Iterator<Item = String> + '_ {
+ | - variable defined here
+LL | None.into_iter()
+LL | .flat_map(move |()| s.chars().map(|c| format!("{}{}", c, s)))
+ | - -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | returns a reference to a captured variable which escapes the closure body
+ | | variable captured here
+ | inferred to be a `FnMut` closure
+ |
+ = note: `FnMut` closures only have access to their captured variables while they are executing...
+ = note: ...therefore, they cannot allow references to captured variables to escape
+help: consider adding 'move' keyword before the nested closure
+ |
+LL | .flat_map(move |()| s.chars().map(move |c| format!("{}{}", c, s)))
+ | ++++
+
+error: lifetime may not live long enough
+ --> $DIR/issue-95079-missing-move-in-nested-closure.rs:9:15
+ |
+LL | move |()| s.chars().map(|c| format!("{}{}", c, s))
+ | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
+ | | |
+ | | return type of closure `Map<Chars<'_>, [closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:9:29: 9:32]>` contains a lifetime `'2`
+ | lifetime `'1` represents this closure's body
+ |
+ = note: closure implements `Fn`, so references to captured variables can't escape the closure
+help: consider adding 'move' keyword before the nested closure
+ |
+LL | move |()| s.chars().map(move |c| format!("{}{}", c, s))
+ | ++++
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.rs b/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.rs
new file mode 100644
index 000000000..31eba0740
--- /dev/null
+++ b/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.rs
@@ -0,0 +1,26 @@
+// Tests the suggestion to reborrow the first move site
+// when we move then borrow a `&mut` ref.
+
+struct State;
+
+impl IntoIterator for &mut State {
+ type IntoIter = std::vec::IntoIter<()>;
+ type Item = ();
+
+ fn into_iter(self) -> Self::IntoIter {
+ vec![].into_iter()
+ }
+}
+
+fn once(f: impl FnOnce()) {}
+
+fn fill_memory_blocks_mt(state: &mut State) {
+ for _ in state {}
+ //~^ HELP consider creating a fresh reborrow of `state` here
+ fill_segment(state);
+ //~^ ERROR borrow of moved value: `state`
+}
+
+fn fill_segment(state: &mut State) {}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr b/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr
new file mode 100644
index 000000000..13a2005e2
--- /dev/null
+++ b/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr
@@ -0,0 +1,24 @@
+error[E0382]: borrow of moved value: `state`
+ --> $DIR/reborrow-sugg-move-then-borrow.rs:20:18
+ |
+LL | fn fill_memory_blocks_mt(state: &mut State) {
+ | ----- move occurs because `state` has type `&mut State`, which does not implement the `Copy` trait
+LL | for _ in state {}
+ | ----- `state` moved due to this implicit call to `.into_iter()`
+LL |
+LL | fill_segment(state);
+ | ^^^^^ value borrowed here after move
+ |
+note: this function takes ownership of the receiver `self`, which moves `state`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ |
+LL | fn into_iter(self) -> Self::IntoIter;
+ | ^^^^
+help: consider creating a fresh reborrow of `state` here
+ |
+LL | for _ in &mut *state {}
+ | ++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
index af26169c8..b1af090ae 100644
--- a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
+++ b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
@@ -5,6 +5,7 @@ LL | cb.map(|cb| cb());
| ^^^--------------
| | |
| | `*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
|
note: this function takes ownership of the receiver `self`, which moves `*cb`
@@ -12,10 +13,6 @@ note: this function takes ownership of the receiver `self`, which moves `*cb`
|
LL | pub const fn map<U, F>(self, f: F) -> Option<U>
| ^^^^
-help: consider calling `.as_ref()` to borrow the type's contents
- |
-LL | cb.as_ref().map(|cb| cb());
- | +++++++++
error[E0596]: cannot borrow `*cb` as mutable, as it is behind a `&` reference
--> $DIR/suggest-as-ref-on-mut-closure.rs:12:26
diff --git a/src/test/ui/borrowck/suggest-assign-rvalue.rs b/src/test/ui/borrowck/suggest-assign-rvalue.rs
new file mode 100644
index 000000000..aaca9d47f
--- /dev/null
+++ b/src/test/ui/borrowck/suggest-assign-rvalue.rs
@@ -0,0 +1,57 @@
+#![allow(dead_code)]
+#![feature(never_type)]
+
+#[derive(Debug, Default)]
+struct Demo {}
+
+#[derive(Debug)]
+struct DemoNoDef {}
+
+fn apple(_: u32) {}
+
+fn banana() {
+ let chaenomeles;
+ apple(chaenomeles);
+ //~^ ERROR used binding `chaenomeles` isn't initialized [E0381]
+}
+
+fn main() {
+ let my_bool: bool = bool::default();
+ println!("my_bool: {}", my_bool);
+
+ let my_float: f32;
+ println!("my_float: {}", my_float);
+ //~^ ERROR used binding `my_float` isn't initialized
+ let demo: Demo;
+ println!("demo: {:?}", demo);
+ //~^ ERROR used binding `demo` isn't initialized
+
+ let demo_no: DemoNoDef;
+ println!("demo_no: {:?}", demo_no);
+ //~^ ERROR used binding `demo_no` isn't initialized
+
+ let arr: [i32; 5];
+ println!("arr: {:?}", arr);
+ //~^ ERROR used binding `arr` isn't initialized
+ let foo: Vec<&str>;
+ println!("foo: {:?}", foo);
+ //~^ ERROR used binding `foo` isn't initialized
+
+ let my_string: String;
+ println!("my_string: {}", my_string);
+ //~^ ERROR used binding `my_string` isn't initialized
+
+ let my_int: &i32;
+ println!("my_int: {}", *my_int);
+ //~^ ERROR used binding `my_int` isn't initialized
+
+ let hello: &str;
+ println!("hello: {}", hello);
+ //~^ ERROR used binding `hello` isn't initialized
+
+ let never: !;
+ println!("never: {}", never);
+ //~^ ERROR used binding `never` isn't initialized [E0381]
+
+ banana();
+}
diff --git a/src/test/ui/borrowck/suggest-assign-rvalue.stderr b/src/test/ui/borrowck/suggest-assign-rvalue.stderr
new file mode 100644
index 000000000..92acba640
--- /dev/null
+++ b/src/test/ui/borrowck/suggest-assign-rvalue.stderr
@@ -0,0 +1,138 @@
+error[E0381]: used binding `chaenomeles` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:14:11
+ |
+LL | let chaenomeles;
+ | ----------- binding declared here but left uninitialized
+LL | apple(chaenomeles);
+ | ^^^^^^^^^^^ `chaenomeles` used here but it isn't initialized
+ |
+help: consider assigning a value
+ |
+LL | let chaenomeles = 0;
+ | +++
+
+error[E0381]: used binding `my_float` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:23:30
+ |
+LL | let my_float: f32;
+ | -------- binding declared here but left uninitialized
+LL | println!("my_float: {}", my_float);
+ | ^^^^^^^^ `my_float` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let my_float: f32 = 0.0;
+ | +++++
+
+error[E0381]: used binding `demo` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:26:28
+ |
+LL | let demo: Demo;
+ | ---- binding declared here but left uninitialized
+LL | println!("demo: {:?}", demo);
+ | ^^^^ `demo` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let demo: Demo = Default::default();
+ | ++++++++++++++++++++
+
+error[E0381]: used binding `demo_no` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:30:31
+ |
+LL | let demo_no: DemoNoDef;
+ | ------- binding declared here but left uninitialized
+LL | println!("demo_no: {:?}", demo_no);
+ | ^^^^^^^ `demo_no` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let demo_no: DemoNoDef = todo!();
+ | +++++++++
+
+error[E0381]: used binding `arr` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:34:27
+ |
+LL | let arr: [i32; 5];
+ | --- binding declared here but left uninitialized
+LL | println!("arr: {:?}", arr);
+ | ^^^ `arr` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let arr: [i32; 5] = todo!();
+ | +++++++++
+
+error[E0381]: used binding `foo` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:37:27
+ |
+LL | let foo: Vec<&str>;
+ | --- binding declared here but left uninitialized
+LL | println!("foo: {:?}", foo);
+ | ^^^ `foo` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let foo: Vec<&str> = vec![];
+ | ++++++++
+
+error[E0381]: used binding `my_string` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:41:31
+ |
+LL | let my_string: String;
+ | --------- binding declared here but left uninitialized
+LL | println!("my_string: {}", my_string);
+ | ^^^^^^^^^ `my_string` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let my_string: String = Default::default();
+ | ++++++++++++++++++++
+
+error[E0381]: used binding `my_int` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:45:28
+ |
+LL | let my_int: &i32;
+ | ------ binding declared here but left uninitialized
+LL | println!("my_int: {}", *my_int);
+ | ^^^^^^^ `*my_int` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let my_int: &i32 = todo!();
+ | +++++++++
+
+error[E0381]: used binding `hello` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:49:27
+ |
+LL | let hello: &str;
+ | ----- binding declared here but left uninitialized
+LL | println!("hello: {}", hello);
+ | ^^^^^ `hello` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider assigning a value
+ |
+LL | let hello: &str = todo!();
+ | +++++++++
+
+error[E0381]: used binding `never` isn't initialized
+ --> $DIR/suggest-assign-rvalue.rs:53:27
+ |
+LL | let never: !;
+ | ----- binding declared here but left uninitialized
+LL | println!("never: {}", never);
+ | ^^^^^ `never` used here but it isn't initialized
+ |
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 10 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/two-phase-across-loop.stderr b/src/test/ui/borrowck/two-phase-across-loop.stderr
index 95896c6bb..22f9b39df 100644
--- a/src/test/ui/borrowck/two-phase-across-loop.stderr
+++ b/src/test/ui/borrowck/two-phase-across-loop.stderr
@@ -2,7 +2,10 @@ 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/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
index 3d395d1f2..da238205b 100644
--- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
+++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
@@ -131,13 +131,13 @@ fn coerce_index_op() {
let mut i = I(10);
i[i[3]] = 4;
//~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
- // Shoud be accepted with g2p
+ // Should be accepted with g2p
i[3] = i[4];
i[i[3]] = i[4];
//~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
- // Shoud be accepted with g2p
+ // Should be accepted with g2p
}
fn main() {
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
index e0f4afa75..0463e22b3 100644
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
@@ -40,6 +40,6 @@ fn main() {
//
// (At least in theory; part of the reason this test fails is that
// the constructed MIR throws in extra &mut reborrows which
- // flummoxes our attmpt to delay the activation point here.)
+ // flummoxes our attempt to delay the activation point here.)
delay.push(2);
}