diff options
287 files changed, 794 insertions, 794 deletions
diff --git a/src/test/ui/E0508.nll.stderr b/src/test/ui/E0508.nll.stderr index 82fdce2112e..983062e450e 100644 --- a/src/test/ui/E0508.nll.stderr +++ b/src/test/ui/E0508.nll.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array --> $DIR/E0508.rs:5:18 | -LL | let _value = array[0]; //~ ERROR [E0508] +LL | let _value = array[0]; | ^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr index 0c9a62351d2..713eeba5459 100644 --- a/src/test/ui/access-mode-in-closures.nll.stderr +++ b/src/test/ui/access-mode-in-closures.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/access-mode-in-closures.rs:8:15 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^^ - data moved here | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | match *s { S(v) => v } //~ ERROR cannot move out note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait --> $DIR/access-mode-in-closures.rs:8:22 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-outlives.nll.stderr b/src/test/ui/associated-types/associated-types-outlives.nll.stderr index c58dc314e8a..840e33b4b8a 100644 --- a/src/test/ui/associated-types/associated-types-outlives.nll.stderr +++ b/src/test/ui/associated-types/associated-types-outlives.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | 's: loop { y = denormalise(&x); break } | -- borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot move out of `x` because it is borrowed +LL | drop(x); | ^ move out of `x` occurs here LL | return f(y); | - borrow later used here diff --git a/src/test/ui/augmented-assignments.nll.stderr b/src/test/ui/augmented-assignments.nll.stderr index 33c94d6e3a5..08f06e90162 100644 --- a/src/test/ui/augmented-assignments.nll.stderr +++ b/src/test/ui/augmented-assignments.nll.stderr @@ -1,14 +1,14 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/augmented-assignments.rs:16:5 | -LL | x //~ error: use of moved value: `x` +LL | x | - | | | _____borrow of `x` occurs here | | -LL | | //~^ value used here after move +LL | | LL | | += -LL | | x; //~ value moved here +LL | | x; | | ^ | | | | |_____move out of `x` occurs here @@ -20,7 +20,7 @@ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable LL | let y = Int(2); | - help: consider changing this to be mutable: `mut y` ... -LL | y //~ error: cannot borrow immutable local variable `y` as mutable +LL | y | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/binop/binop-consume-args.nll.stderr b/src/test/ui/binop/binop-consume-args.nll.stderr index 59b5aba93ca..5751af27fcb 100644 --- a/src/test/ui/binop/binop-consume-args.nll.stderr +++ b/src/test/ui/binop/binop-consume-args.nll.stderr @@ -7,7 +7,7 @@ LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -19,8 +19,8 @@ LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -32,7 +32,7 @@ LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -44,8 +44,8 @@ LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -57,7 +57,7 @@ LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -69,8 +69,8 @@ LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -82,7 +82,7 @@ LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -94,8 +94,8 @@ LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -107,7 +107,7 @@ LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -119,8 +119,8 @@ LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -132,7 +132,7 @@ LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -144,8 +144,8 @@ LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -157,7 +157,7 @@ LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -169,8 +169,8 @@ LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -182,7 +182,7 @@ LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -194,8 +194,8 @@ LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -207,7 +207,7 @@ LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -219,8 +219,8 @@ LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -232,7 +232,7 @@ LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -244,8 +244,8 @@ LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error: aborting due to 20 previous errors diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr index 7c84e8833a9..7d54de655bf 100644 --- a/src/test/ui/binop/binop-move-semantics.nll.stderr +++ b/src/test/ui/binop/binop-move-semantics.nll.stderr @@ -8,7 +8,7 @@ LL | fn double_move<T: Add<Output=()>>(x: T) { LL | x | - value moved here LL | + -LL | x; //~ ERROR: use of moved value +LL | x; | ^ value used here after move error[E0382]: borrow of moved value: `x` @@ -21,7 +21,7 @@ LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) { LL | x | - value moved here LL | + -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value borrowed here after move error[E0505]: cannot move out of `x` because it is borrowed @@ -30,7 +30,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | -- borrow of `x` occurs here ... -LL | x //~ ERROR: cannot move out of `x` because it is borrowed +LL | x | ^ move out of `x` occurs here ... LL | use_mut(n); use_imm(m); @@ -42,7 +42,7 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | ------ borrow of `y` occurs here ... -LL | y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | y; | ^ move out of `y` occurs here LL | use_mut(n); use_imm(m); | - borrow later used here @@ -50,13 +50,13 @@ LL | use_mut(n); use_imm(m); error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:30:5 | -LL | *m //~ ERROR: cannot move out of borrowed content +LL | *m | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:32:5 | -LL | *n; //~ ERROR: cannot move out of borrowed content +LL | *n; | ^^ cannot move out of borrowed content error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable @@ -68,7 +68,7 @@ LL | &mut f | _____mutable borrow occurs here | | LL | | + -LL | | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable +LL | | &f; | | ^- | |_____|| | |mutable borrow later used here @@ -83,7 +83,7 @@ LL | &f | _____immutable borrow occurs here | | LL | | + -LL | | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable +LL | | &mut f; | | ^^^^^- | |_____|____| | | immutable borrow later used here diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr index 9174a697611..af45c8a980d 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr @@ -1,73 +1,73 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:18:31 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^^^^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:30:36 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr index 72a29b864a4..5c40555c501 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | ---- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here LL | LL | r.use_ref(); @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | ---- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); | - immutable borrow later used here @@ -24,7 +24,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | -------- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_ref(); | - first borrow later used here @@ -34,7 +34,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | ---- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here LL | r.use_ref(); | - borrow later used here @@ -44,7 +44,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | ---- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); | - immutable borrow later used here @@ -54,7 +54,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | -------- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_mut(); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-and-init.nll.stderr b/src/test/ui/borrowck/borrowck-and-init.nll.stderr index b4b02cf208a..2db07519481 100644 --- a/src/test/ui/borrowck/borrowck-and-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `i` --> $DIR/borrowck-and-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr index 43c74988f9e..7a959fb6ec6 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Y(ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | Y(ref mut b, _) => b //~ ERROR cannot borrow +LL | Y(ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr index 15859040f06..88a8867f5ee 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | (ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | (ref mut b, _) => b //~ ERROR cannot borrow +LL | (ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr index 2f4cf7dd800..6c8a32ee391 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr @@ -19,7 +19,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed LL | Foo::Y(ref mut a, _) => a, | --------- borrow of `y.0` occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0` ... LL | *a += 1; @@ -31,7 +31,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Foo::Y(ref mut a, _) => a, | --------- first mutable borrow occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-argument.nll.stderr b/src/test/ui/borrowck/borrowck-argument.nll.stderr index 9e7f0930ee5..cf158331409 100644 --- a/src/test/ui/borrowck/borrowck-argument.nll.stderr +++ b/src/test/ui/borrowck/borrowck-argument.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn func(arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn method(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable @@ -19,13 +19,13 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn default(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable 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); //~ ERROR: cannot borrow immutable argument +LL | (|arg: S| { arg.mutate() })(s); | --- ^^^ cannot borrow as mutable | | | help: consider changing this to be mutable: `mut arg` diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr index 71f36c2b045..93f1d8c5258 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta LL | let q: &isize = &p[0]; | - immutable borrow occurs here LL | -LL | p[0] = 5; //~ ERROR cannot borrow +LL | p[0] = 5; | ^ mutable borrow occurs here LL | LL | println!("{}", *q); @@ -17,7 +17,7 @@ LL | borrow( | ------ immutable borrow later used by call LL | &p, | -- immutable borrow occurs here -LL | || p[0] = 5); //~ ERROR cannot borrow `p` as mutable +LL | || p[0] = 5); | ^^ - second borrow occurs due to use of `p` in closure | | | mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr index 469199d69b9..d8ccf36852a 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference | LL | fn a(s: &S) { | -- help: consider changing this to be a mutable reference: `&mut S<'_>` -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference @@ -11,7 +11,7 @@ error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference | LL | fn c(s: & &mut S) { | -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>` -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr index 8e3e9d41f8c..0aacaf9cf47 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `y` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ use of borrowed `y` LL | *z.pointer += 1; | --------------- borrow later used here @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `*y.pointer` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here LL | *z.pointer += 1; | --------------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr index 53aaa4a2957..3ed76c13f6a 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x = Foo { x: 3 }; | - help: consider changing this to be mutable: `mut x` -LL | x.printme(); //~ ERROR cannot borrow +LL | x.printme(); | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr index 9e62534c671..c2dfb687e8e 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr +++ b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr @@ -5,7 +5,7 @@ LL | (&mut x).with( | -------- ---- first borrow later used by call | | | first mutable borrow occurs here -LL | |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time +LL | |opt| { | ^^^^^ second mutable borrow occurs here ... LL | x = X(Either::Left((0, 0))); diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr index 1732628d40f..e273a778fda 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr @@ -5,7 +5,7 @@ LL | add( | --- immutable borrow later used by call LL | &*a, | --- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable @@ -15,7 +15,7 @@ LL | add( | --- immutable borrow later used by call LL | &*a, | --- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr index 117567cba19..371bcf2b69c 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr @@ -5,7 +5,7 @@ LL | add( | --- borrow later used by call LL | &*a, | --- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -15,7 +15,7 @@ LL | add( | --- borrow later used by call LL | &*a, | --- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr index ea17fafc939..d2a49962baf 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-block-unint.rs:4:11 | -LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x` +LL | force(|| { | ^^ use of possibly uninitialized `x` LL | println!("{}", x); | - borrow occurs due to use in closure diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr index d1377fd439a..ad6bd7dc942 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo2 = &*foo; LL | *bar1; | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as m | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as imm | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as m | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr index f53cb32a567..b5c61847918 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo2 = &foo; LL | *bar1; | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mu | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &foo; | ^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immu | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as m | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr index 52bc3e98296..71bf052c93d 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/borrowck-borrow-from-temporary.rs:10:5 | -LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough +LL | let &Foo(ref x) = &id(Foo(3)); | ---------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr index 82b9449de50..7c1c063d260 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to `**t1` which is behind a `&` reference LL | let t1 = t0; | -- help: consider changing this to be a mutable reference: `&mut &mut isize` LL | let p: &isize = &**t0; -LL | **t1 = 22; //~ ERROR cannot assign +LL | **t1 = 22; | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable @@ -12,7 +12,7 @@ error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as m | LL | let t1 = &mut *t0; | -------- mutable borrow occurs here -LL | let p: &isize = &**t0; //~ ERROR cannot borrow +LL | let p: &isize = &**t0; | ^^^^^ immutable borrow occurs here LL | **t1 = 22; | --------- mutable borrow later used here @@ -22,7 +22,7 @@ error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference | LL | fn foo4(t0: & &mut isize) { | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize` -LL | let x: &mut isize = &mut **t0; //~ ERROR cannot borrow +LL | let x: &mut isize = &mut **t0; | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr index c329fc9e910..fa0ae318e72 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let y = x.f1(); | - first mutable borrow occurs here -LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable +LL | x.f2(); | ^ second mutable borrow occurs here LL | y.use_ref(); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr index ecb013b7a16..4fc320c5059 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr @@ -1,85 +1,85 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:19 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:19 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:5 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:5 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr index 1c3131806be..cc4d91a58e9 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr @@ -1,43 +1,43 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:23:19 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:27:19 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:35:5 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:39:5 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5 | -LL | *x = 3; //~ ERROR cannot assign +LL | *x = 3; | ^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot assign error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr index 97dc59c9543..1dd18c12fc8 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20 | -LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough +LL | let x = defer(&vec!["Goodbye", "world!"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr index d6e599d1abf..c91a4377b4c 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:28 | -LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough +LL | buggy_map.insert(42, &*Box::new(1)); | ^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr index 177a2738772..e40d8d9dfcc 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit-2.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr index 64d1e629fec..bbf9b9f1241 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr index 8123e17ce9d..0064417c57b 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr @@ -17,7 +17,7 @@ LL | let mut c1 = || set(&mut *x); | -- - first borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | //~^ ERROR cannot borrow +LL | LL | let mut c2 = || set(&mut *x); | ^^ - second borrow occurs due to use of `x` in closure | | diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr index 18f95f232cd..471173e595f 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr @@ -9,7 +9,7 @@ LL | let mut c2 = || set(&mut *x); | ^^ - second borrow occurs due to use of `x` in closure | | | second closure is constructed here -LL | //~^ ERROR two closures require unique access to `x` at the same time +LL | LL | c2(); c1(); | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr index d3d11e8451c..07f477d1786 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr @@ -5,7 +5,7 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -19,7 +19,7 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -33,7 +33,7 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -51,7 +51,7 @@ LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `x` as mutable more than once +LL | LL | c1; | -- first borrow later used here @@ -66,7 +66,7 @@ LL | let c2 = to_fn_mut(|| set(&mut *x.f)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `x` as mutable more than once +LL | LL | c1; | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr index 80e042fc8fc..b8bbb31a355 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as i | LL | let p = &this.x; | ------- immutable borrow occurs here -LL | &mut this.x; //~ ERROR cannot borrow +LL | &mut this.x; | ^^^^^^^^^^^ mutable borrow occurs here LL | p.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr index d6082734451..3106f36ac8b 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr @@ -5,7 +5,7 @@ LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x` +LL | let c2 = || set(x); | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -19,7 +19,7 @@ LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` +LL | let c2 = || { get(x); set(x); }; | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -33,7 +33,7 @@ LL | let c1 = || set(x); | -- - first borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time +LL | let c2 = || set(x); | ^^ - second borrow occurs due to use of `x` in closure | | | second closure is constructed here @@ -45,7 +45,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` -LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument +LL | let c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error: aborting due to 4 previous errors diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr index 4501e28a188..a6dbcf36077 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr @@ -6,7 +6,7 @@ LL | let mut test = |foo: &Foo| { LL | ptr = box Foo { x: ptr.x + 1 }; | --- first borrow occurs due to use of `ptr` in closure LL | }; -LL | test(&*ptr); //~ ERROR cannot borrow `*ptr` +LL | test(&*ptr); | ---- ^^^^^ immutable borrow occurs here | | | mutable borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr index ea7683a91ad..c69237fa95f 100644 --- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(b: Box<[i32;5]>) { | - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr index 15cf359326b..e8194ad6944 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(b: Box<Foo+Send>) { | - move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr index 25a9a112044..b3451659bec 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.b` | LL | let y = A { a: 3, .. x }; | ---------------- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: borrow of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^^ value borrowed here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: borrow of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^^ value borrowed here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | ---- borrow of `x.b` occurs here -LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed +LL | drop(x.b); | ^^^ move out of `x.b` occurs here LL | drop(**p); | --- borrow later used here @@ -53,7 +53,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | ---- borrow of `x.b` occurs here -LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed +LL | let _y = A { a: 3, .. x }; | ^^^^^^^^^^^^^^^^ move out of `x.b` occurs here LL | drop(**p); | --- borrow later used here @@ -63,7 +63,7 @@ error[E0499]: cannot borrow `x.a` as mutable more than once at a time | LL | let p = &mut x.a; | -------- first mutable borrow occurs here -LL | let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time +LL | let q = &mut x.a; | ^^^^^^^^ second mutable borrow occurs here LL | drop(*p); | -- first borrow later used here @@ -73,7 +73,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait @@ -83,7 +83,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait @@ -93,7 +93,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 3, .. x }; | ^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait @@ -103,7 +103,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 4, .. x }; | ^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr index 7d8618e16d9..d48866dce04 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr @@ -1,7 +1,7 @@ error[E0713]: borrow may still be in use when destructor runs --> $DIR/borrowck-fn-in-const-c.rs:17:16 | -LL | return &local.inner; //~ ERROR does not live long enough +LL | return &local.inner; | ^^^^^^^^^^^^ returning this value requires that `local.inner` is borrowed for `'static` LL | } | - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr index 8ba6a07b3d2..08cafa7da7a 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | -- ^^^^^^^^ cannot move out of borrowed content | || | |data moved here @@ -10,13 +10,13 @@ LL | for &a in x.iter() { //~ ERROR cannot move out note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:10 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | -- ^^^^ cannot move out of borrowed content | || | |data moved here @@ -25,13 +25,13 @@ LL | for &a in &f.a { //~ ERROR cannot move out note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:10 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | ^ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | -- ^^^^^^^^ cannot move out of borrowed content | || | |data moved here @@ -40,7 +40,7 @@ LL | for &a in x.iter() { //~ ERROR cannot move out note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr index 32ca24ba6ec..f47dce45369 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr @@ -7,7 +7,7 @@ LL | for &x in &vector { | immutable borrow occurs here | immutable borrow later used here LL | let cap = vector.capacity(); -LL | vector.extend(repeat(0)); //~ ERROR cannot borrow +LL | vector.extend(repeat(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable @@ -19,7 +19,7 @@ LL | for &x in &vector { | immutable borrow occurs here | immutable borrow later used here ... -LL | vector[1] = 5; //~ ERROR cannot borrow +LL | vector[1] = 5; | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr index ff094ecf707..da639a837aa 100644 --- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable +LL | Box::new(|| x) | ^ cannot move out of captured variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr index b99d5e813c7..b004447bf45 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr @@ -5,7 +5,7 @@ LL | f.foo( | ^ --- first borrow later used by call | ___| | | -LL | | |a| { //~ ERROR closure requires unique access to `f` +LL | | |a| { | | --- closure construction occurs here LL | | f.n.insert(*a); | | - first borrow occurs due to use of `f` in closure @@ -19,7 +19,7 @@ LL | f.foo( | - --- first borrow later used by call | | | borrow occurs here -LL | |a| { //~ ERROR closure requires unique access to `f` +LL | |a| { | ^^^ closure construction occurs here LL | f.n.insert(*a); | - second borrow occurs due to use of `f` in closure diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr index 3da8d8f8c47..4ea4eb8f007 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Some(ref _y) => { | ------ borrow of `x.0` occurs here -LL | let _a = x; //~ ERROR cannot move +LL | let _a = x; | ^ move out of `x` occurs here LL | _y.use_ref(); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr index 061c458f73e..4ef36df52df 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-issue-2657-2.rs:7:18 | -LL | let _b = *y; //~ ERROR cannot move out +LL | let _b = *y; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr index 0c99edeb1a4..68a82bdb57c 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immut LL | _w = &v; | -- immutable borrow occurs here LL | } -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr index ae3313597a3..07b11b3e728 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immut | LL | let _w = &v; | -- immutable borrow occurs here -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr index 450102f0c66..615660febbc 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let w = &v; | -- borrow of `v` occurs here -LL | take(v); //~ ERROR cannot move out of `v` because it is borrowed +LL | take(v); | ^ move out of `v` occurs here LL | w.use_ref(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr index 281a8103f97..1d1522a15b1 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr @@ -5,7 +5,7 @@ LL | borrow(&*v, | ------ --- immutable borrow occurs here | | | immutable borrow later used by call -LL | |w| { //~ ERROR cannot borrow `v` as mutable +LL | |w| { | ^^^ mutable borrow occurs here LL | v = box 4; | - second borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr index 69845758903..6994c837dfc 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr @@ -6,7 +6,7 @@ LL | let alias: &'static mut String = s; | | | type annotation requires that `*s` is borrowed for `'static` ... -LL | *s = String::new(); //~ ERROR cannot assign +LL | *s = String::new(); | ^^ assignment to borrowed `*s` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr index 421af61ff78..ad74a89f668 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed LL | let q = &mut p; | ------ borrow of `p` occurs here LL | -LL | p + 3; //~ ERROR cannot use `p` +LL | p + 3; | ^ use of borrowed `p` ... LL | *q + 3; // OK to use the new alias `q` @@ -16,7 +16,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta LL | let q = &mut p; | ------ mutable borrow occurs here ... -LL | p.times(3); //~ ERROR cannot borrow `p` +LL | p.times(3); | ^ immutable borrow occurs here LL | LL | *q + 3; // OK to use the new alias `q` diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr index bded4d1e0a3..ec3edc80323 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable --> $DIR/borrowck-loan-rcvr.rs:23:14 | -LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable +LL | p.blockm(|| { | - ------ ^^ mutable borrow occurs here | | | | | immutable borrow later used by call @@ -14,7 +14,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(); //~ ERROR cannot borrow +LL | p.impurem(); | ^ immutable borrow occurs here LL | LL | l.x += 1; diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr index be48f217ef1..6691a2396a1 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr @@ -5,7 +5,7 @@ LL | takes_imm_elt( | ------------- immutable borrow later used by call LL | &v[0], | - immutable borrow occurs here -LL | || { //~ ERROR cannot borrow `v` as mutable +LL | || { | ^^ mutable borrow occurs here LL | v[1] = 4; | - second borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr index b8a01174417..38f6ca7be75 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure LL | let bar: Box<_> = box 3; | --- captured outer variable LL | let _g = to_fn_mut(|| { -LL | let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of +LL | let _h = to_fn_once(move || -> isize { *bar }); | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of captured variable in an `FnMut` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr index 9386278886f..25eb8d0134c 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr @@ -1,12 +1,12 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:11:11 | -LL | match *f { //~ ERROR cannot move out of +LL | match *f { | ^^ | | | cannot move out of borrowed content | help: consider removing the `*`: `f` -LL | //~| cannot move out +LL | LL | Foo::Foo1(num1, | ---- data moved here LL | num2) => (), @@ -46,12 +46,12 @@ LL | g: _t error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:47:11 | -LL | match a.a { //~ ERROR cannot move out of +LL | match a.a { | ^^^ | | | cannot move out of borrowed content | help: consider borrowing here: `&a.a` -LL | //~| cannot move out +LL | LL | n => { | - data moved here | diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr index b7fa2247e32..e4840fba672 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `*a` because it is borrowed LL | let b = &a; | -- borrow of `a` occurs here LL | -LL | let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed +LL | let z = *a; | ^^ move out of `*a` occurs here LL | b.use_ref(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr index 5b784657953..615e3fd1800 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of dereference of raw pointer --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | -LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer +LL | let y = *x; | ^^ | | | cannot move out of dereference of raw pointer diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr index ce6433d5a52..77f5b72e51c 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `t0` because it is borrowed | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- borrow of `*t0` occurs here -LL | let t1 = t0; //~ ERROR cannot move out of `t0` +LL | let t1 = t0; | ^^ move out of `t0` occurs here LL | *t1 = 22; LL | p.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr index 9aaeefd4cfc..51caf60da6e 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr @@ -20,9 +20,9 @@ LL | Foo { string: b }] => { help: consider removing the `&` | LL | [Foo { string: a }, -LL | //~^ ERROR cannot move out of type `[Foo]` -LL | //~| cannot move out -LL | //~| to prevent move +LL | +LL | +LL | LL | Foo { string: b }] => { | diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr index 3bb5351f97b..8c9083fcf13 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a.x` because it is borrowed | LL | let pb = &a; | -- borrow of `a` occurs here -LL | let S { x: ax } = a; //~ ERROR cannot move out +LL | let S { x: ax } = a; | ^^ move out of `a.x` occurs here LL | f(pb); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr index d0065a2e7dc..32c7067acc8 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr @@ -6,7 +6,7 @@ LL | let p1 = &x1; ... LL | thread::spawn(move|| { | ^^^^^^ move out of `x1` occurs here -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed +LL | drop(x1); | -- move occurs due to use in closure ... LL | borrow(&*p1); @@ -19,8 +19,8 @@ LL | let p2 = &x2; | --- borrow of `x2` occurs here LL | thread::spawn(move|| { | ^^^^^^ move out of `x2` occurs here -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed -LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed +LL | drop(x1); +LL | drop(x2); | -- move occurs due to use in closure ... LL | borrow(&*p2); @@ -36,7 +36,7 @@ LL | drop(x1); ... LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x1); //~ ERROR capture of moved value: `x1` +LL | drop(x1); | -- use occurs due to use in closure error[E0382]: use of moved value: `x2` @@ -48,16 +48,16 @@ LL | drop(x2); | -- value moved here LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x1); //~ ERROR capture of moved value: `x1` -LL | drop(x2); //~ ERROR capture of moved value: `x2` +LL | drop(x1); +LL | drop(x2); | -- use occurs due to use in closure error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:36:14 | -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait @@ -69,7 +69,7 @@ LL | let p = &x; | -- borrow of `x` occurs here LL | thread::spawn(move|| { | ^^^^^^ move out of `x` occurs here -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - move occurs due to use in closure ... LL | borrow(&*p); @@ -78,9 +78,9 @@ LL | borrow(&*p); error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:46:14 | -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait @@ -94,7 +94,7 @@ LL | drop(x); | - value moved here LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - use occurs due to use in closure error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr index be69be63411..d58548f2204 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x: isize = 3; | - help: consider changing this to be mutable: `mut x` -LL | let y: &mut isize = &mut x; //~ ERROR cannot borrow +LL | let y: &mut isize = &mut x; | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr index 666ccf35a7c..925930acf86 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immut | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^^^^^^ mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` LL | p.use_ref(); @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `t0` as mutable more than once at a time | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | -------- first mutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^^^^^^ second mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` but not through `*p` LL | p.use_mut(); diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr index 5a9ec98a2db..8e7ffdc6819 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | LL | let v = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` -LL | write(&mut v); //~ ERROR cannot borrow +LL | write(&mut v); | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr index b106708352e..3462b7610d3 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Cycle::Node(ref mut y) => { | --------- borrow of `x.0` occurs here -LL | y.a = x; //~ ERROR cannot move out of +LL | y.a = x; | --- ^ move out of `x` occurs here | | | borrow later used here diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr index ff0cc933232..cf94c74dec2 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr +++ b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = x.mut_borrowed(); //~ ERROR cannot borrow +LL | let z = x.mut_borrowed(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-or-init.nll.stderr b/src/test/ui/borrowck/borrowck-or-init.nll.stderr index dcd2c18dcaa..122f5192720 100644 --- a/src/test/ui/borrowck/borrowck-or-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `i` --> $DIR/borrowck-or-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr index c5a4c4e005a..b7fcaa645af 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as muta | LL | let sp = &mut s; | ------ mutable borrow occurs here -LL | s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable +LL | s(3); | ^ immutable borrow occurs here LL | use_mut(sp); | -- mutable borrow later used here @@ -14,7 +14,7 @@ error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable LL | let s = SFnMut { | - help: consider changing this to be mutable: `mut s` ... -LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable +LL | s(3); | ^ cannot borrow as mutable error[E0382]: use of moved value: `s` @@ -25,7 +25,7 @@ LL | let s = SFnOnce { ... LL | s(" world".to_string()); | - value moved here -LL | s(" world".to_string()); //~ ERROR use of moved value: `s` +LL | s(" world".to_string()); | ^ value used here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr index 13ace0178f8..5f34749ca89 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mut | LL | let p = &mut f[&s]; | - mutable borrow occurs here -LL | let q = &f[&s]; //~ ERROR cannot borrow +LL | let q = &f[&s]; | ^ immutable borrow occurs here LL | p.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time | LL | let p = &mut f[&s]; | - first mutable borrow occurs here -LL | let q = &mut f[&s]; //~ ERROR cannot borrow +LL | let q = &mut f[&s]; | ^ second mutable borrow occurs here LL | p.use_mut(); | - first borrow later used here @@ -23,7 +23,7 @@ error[E0499]: cannot borrow `f.foo` as mutable more than once at a time | LL | let p = &mut f.foo[&s]; | ----- first mutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ second mutable borrow occurs here LL | p.use_mut(); | - first borrow later used here @@ -33,7 +33,7 @@ error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as im | LL | let p = &f.foo[&s]; | ----- immutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ mutable borrow occurs here LL | p.use_ref(); | - immutable borrow later used here @@ -43,7 +43,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here LL | p.use_ref(); | - borrow later used here @@ -53,7 +53,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here LL | p.use_ref(); | - borrow later used here @@ -63,7 +63,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here LL | p.use_mut(); | - borrow later used here @@ -73,7 +73,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here LL | p.use_mut(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr index 6b41b6f9c4f..21bc8bb06cc 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo2 = &*foo; LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as m | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^^ immutable borrow occurs here LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as imm | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` referen | LL | fn borrow_mut_from_imm(foo: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` -LL | let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr index 67948ad3879..e744fc6b54b 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable LL | fn destructure(x: Option<isize>) -> isize { | - help: consider changing this to be mutable: `mut x` ... -LL | Some(ref mut v) => *v //~ ERROR cannot borrow +LL | Some(ref mut v) => *v | ^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr index 7b026ee9951..ee8f90edcd3 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr @@ -3,8 +3,8 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | //~^ mutable borrow occurs here -LL | let z = &x; //~ ERROR cannot borrow +LL | +LL | let z = &x; | ^^ immutable borrow occurs here ... LL | y.use_mut(); @@ -15,8 +15,8 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = &x; | -- immutable borrow occurs here -LL | //~^ immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here ... LL | y.use_ref(); @@ -27,8 +27,8 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | //~^ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here ... LL | y.use_mut(); diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr index 65f910de4c3..d54449ac4ad 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing function parameter `x` --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:5 | -LL | (&x).clone() //~ ERROR `x` does not live long enough +LL | (&x).clone() | ----^^^^^^^^ | | | returns a value referencing data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr index 8fdd5ef4ca6..1c55953c91f 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immut | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here -LL | swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0` +LL | swap(&mut t0, &mut t1); | ^^^^^^^ mutable borrow occurs here LL | *t1 = 22; LL | p.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr index 363a5a69a07..ec1cf4a4e2b 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as muta | LL | let g = &mut f; | ------ mutable borrow occurs here -LL | f(1, 2); //~ ERROR cannot borrow `f` as immutable +LL | f(1, 2); | ^ immutable borrow occurs here LL | use_mut(g); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable | LL | fn b<F:FnMut(isize, isize) -> isize>(f: F) { | - help: consider changing this to be mutable: `mut f` -LL | f(1, 2); //~ ERROR cannot borrow immutable argument +LL | f(1, 2); | ^ cannot borrow as mutable error[E0382]: use of moved value: `f` @@ -25,7 +25,7 @@ LL | fn c<F:FnOnce(isize, isize) -> isize>(f: F) { | consider adding a `Copy` constraint to this type argument LL | f(1, 2); | - value moved here -LL | f(1, 2); //~ ERROR use of moved value +LL | f(1, 2); | ^ value used here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr index 6bb6fc4cf29..61569b9cac1 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed | LL | let ra = &mut u.s.a; | ---------- borrow of `u.s.a` occurs here -LL | let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed +LL | let b = u.c; | ^^^ use of borrowed `u.s.a` LL | ra.use_mut(); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr index 5cba30b43b8..518f062ba1a 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immu | LL | let ra = &u.a; | ---- immutable borrow occurs here -LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable +LL | let rma = &mut u.a; | ^^^^^^^^ mutable borrow occurs here LL | drop(ra); | -- immutable borrow later used here @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let ra = &u.a; | ---- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here LL | drop(ra); | -- borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as mutable because it is also borrow | LL | let ra = &u.a; | ---- immutable borrow occurs here (via `u.a`) -LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) +LL | let rmb = &mut u.b; | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(ra); | -- immutable borrow later used here @@ -35,7 +35,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let ra = &u.a; | ---- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here LL | drop(ra); | -- borrow later used here @@ -45,7 +45,7 @@ error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mu | LL | let rma = &mut u.a; | -------- mutable borrow occurs here -LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable +LL | let ra = &u.a; | ^^^^ immutable borrow occurs here LL | drop(rma); | --- mutable borrow later used here @@ -55,7 +55,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here -LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed +LL | let a = u.a; | ^^^ use of borrowed `u.a` LL | drop(ra); | -- borrow later used here @@ -65,7 +65,7 @@ error[E0499]: cannot borrow `u.a` as mutable more than once at a time | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here -LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time +LL | let rma2 = &mut u.a; | ^^^^^^^^ second mutable borrow occurs here LL | drop(rma); | --- first borrow later used here @@ -75,7 +75,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let rma = &mut u.a; | -------- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here LL | drop(rma); | --- borrow later used here @@ -85,7 +85,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borr | LL | let rma = &mut u.a; | -------- mutable borrow occurs here (via `u.a`) -LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) +LL | let rb = &u.b; | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(rma); | --- mutable borrow later used here @@ -97,7 +97,7 @@ error[E0503]: cannot use `u.b` because it was mutably borrowed | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here -LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed +LL | let b = u.b; | ^^^ use of borrowed `u.a` LL | LL | drop(ra); @@ -108,7 +108,7 @@ error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here (via `u.a`) -LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time +LL | let rmb2 = &mut u.b; | ^^^^^^^^ second mutable borrow occurs here (via `u.b`) LL | drop(rma); | --- first borrow later used here @@ -120,7 +120,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let rma = &mut u.a; | -------- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here LL | drop(rma); | --- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr index e59fef2dc0d..0b1714fd75d 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr @@ -5,7 +5,7 @@ LL | let mut u = U { a: A }; | ----- move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.a; | --- value moved here -LL | let a = u.a; //~ ERROR use of moved value: `u.a` +LL | let a = u.a; | ^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-move.nll.stderr b/src/test/ui/borrowck/borrowck-union-move.nll.stderr index 1392a7931c3..abbb0142a9c 100644 --- a/src/test/ui/borrowck/borrowck-union-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move.nll.stderr @@ -5,7 +5,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u.n1; //~ ERROR use of moved value: `u.n1` +LL | let a = u.n1; | ^^^^ value used here after move error[E0382]: use of moved value: `u` @@ -15,7 +15,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move error[E0382]: use of moved value: `u` @@ -25,7 +25,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u.n2; //~ ERROR use of moved value: `u.n2` +LL | let a = u.n2; | ^^^^ value used here after move error[E0382]: use of moved value: `u` @@ -35,7 +35,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u.n; //~ ERROR use of moved value: `u.n` +LL | let a = u.n; | ^^^ value used here after move error[E0382]: use of moved value: `u` @@ -45,7 +45,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u.c; //~ ERROR use of moved value: `u.c` +LL | let a = u.c; | ^^^ value used here after move error[E0382]: use of moved value: `u` @@ -55,7 +55,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr index 7ca277ac074..923edc8edae 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut | LL | let w = &mut v; | ------ mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | w.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut | LL | x = &mut v; | ------ mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | x.use_mut(); | - mutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr index e7b972fb014..91d69c51e81 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x` LL | *p = 2; | ------ borrow later used here @@ -13,7 +13,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x.a` LL | *p = 3; | ------ borrow later used here @@ -23,7 +23,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x` LL | p.a = 3; | ------- borrow later used here @@ -33,7 +33,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x.a` LL | *p = 3; | ------ borrow later used here @@ -43,7 +43,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x` LL | drop(y); LL | p.a = 4; @@ -54,7 +54,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x.a` LL | drop(y); LL | *p = 4; @@ -65,7 +65,7 @@ error[E0503]: cannot use `*x` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed +LL | drop(*x); | ^^ use of borrowed `x` LL | **p = 2; | ------- borrow later used here @@ -75,7 +75,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x` LL | p.a = 3; | ------- borrow later used here @@ -85,7 +85,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x.b; | -------- borrow of `x.b` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x.b` LL | **p = 3; | ------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr index eabd0731388..da6d9293b40 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:10:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | tail @@ -10,7 +10,7 @@ LL | tail error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | init @@ -19,7 +19,7 @@ LL | init error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | slice diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr index 0059dd60f84..251f4459290 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time LL | let vb: &mut [isize] = &mut v; | ------ first mutable borrow occurs here ... -LL | v.push(tail[0] + tail[1]); //~ ERROR cannot borrow +LL | v.push(tail[0] + tail[1]); | ^ ------- first borrow later used here | | | second mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr index 018a3173af1..aafcb3160d1 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr @@ -3,10 +3,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed | LL | [box ref _a, _, _] => { | ------ borrow of `vec[_]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^ assignment to borrowed `vec[_]` occurs here -LL | //~^ assignment to borrowed `vec[..]` occurs here +LL | LL | _a.use_ref(); | -- borrow later used here @@ -15,10 +15,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed | LL | &mut [ref _b..] => { | ------ borrow of `vec[_]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^ assignment to borrowed `vec[_]` occurs here -LL | //~^ assignment to borrowed `vec[..]` occurs here +LL | LL | _b.use_ref(); | -- borrow later used here @@ -27,19 +27,19 @@ error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy sli | LL | match vec { | ^^^ cannot move out of here -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | -- data moved here | note: move occurs because `_a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait --> $DIR/borrowck-vec-pattern-nesting.rs:34:15 | -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | ^^ help: consider removing the `&mut` | -LL | [_a, //~ ERROR cannot move out -LL | //~| cannot move out -LL | //~| to prevent move +LL | [_a, +LL | +LL | LL | .. LL | ] => { | @@ -47,7 +47,7 @@ LL | ] => { error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -69,15 +69,15 @@ LL | _b] => {} | ^^ help: consider removing the `&mut` | -LL | [ //~ ERROR cannot move out -LL | //~^ cannot move out +LL | [ +LL | LL | _b] => {} | error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:60:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -88,7 +88,7 @@ error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy sli | LL | match vec { | ^^^ cannot move out of here -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ----------------- | | | | | | | | | ...and here @@ -99,13 +99,13 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/borrowck-vec-pattern-nesting.rs:68:15 | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ^^ ^^ ^^ error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:72:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr index d9d3930dc49..c1290a6f63f 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5 | -LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | tail diff --git a/src/test/ui/borrowck/borrowck-while-break.nll.stderr b/src/test/ui/borrowck/borrowck-while-break.nll.stderr index 1defa3da60c..0fe3cdc96a8 100644 --- a/src/test/ui/borrowck/borrowck-while-break.nll.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `v` --> $DIR/borrowck-while-break.rs:7:20 | -LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` +LL | println!("{}", v); | ^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr index cd88e25cc42..4b29beb02b3 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr @@ -1,7 +1,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(); //~ ERROR +LL | Index::index(&v, 1..2).make_ascii_uppercase(); | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content diff --git a/src/test/ui/borrowck/index-mut-help.nll.stderr b/src/test/ui/borrowck/index-mut-help.nll.stderr index e7047f0048d..92b94209c4e 100644 --- a/src/test/ui/borrowck/index-mut-help.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help.rs:11:5 | -LL | map["peter"].clear(); //~ ERROR +LL | map["peter"].clear(); | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` @@ -9,13 +9,13 @@ LL | map["peter"].clear(); //~ ERROR error[E0594]: cannot assign to data in a `&` reference --> $DIR/index-mut-help.rs:12:5 | -LL | map["peter"] = "0".to_string(); //~ ERROR +LL | map["peter"] = "0".to_string(); | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help.rs:13:13 | -LL | let _ = &mut map["peter"]; //~ ERROR +LL | let _ = &mut map["peter"]; | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr index 255eb757a49..eb71ab0b7ec 100644 --- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr +++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-47215-ice-from-drop-elab.rs:17:21 | -LL | let mut x = X; //~ ERROR cannot move out of thread-local static item [E0507] +LL | let mut x = X; | ^ | | | cannot move out of static item diff --git a/src/test/ui/borrowck/issue-51117.nll.stderr b/src/test/ui/borrowck/issue-51117.nll.stderr index 140be098a99..f8a9608ad37 100644 --- a/src/test/ui/borrowck/issue-51117.nll.stderr +++ b/src/test/ui/borrowck/issue-51117.nll.stderr @@ -3,7 +3,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(); //~ ERROR cannot borrow +LL | bar.take(); | ^^^ second mutable borrow occurs here LL | drop(baz); | --- first borrow later used here diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr index ab05358d03f..eda2f518f92 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop @@ -16,7 +16,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop @@ -28,7 +28,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr index 5ee31b5efd0..09dabbc89b4 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable | LL | fn f(b: &mut i32) { | - help: consider changing this to be mutable: `mut b` -LL | g(&mut b) //~ ERROR cannot borrow +LL | g(&mut b) | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr index 9b20fc02319..4fcb693f1bf 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time | LL | let first = &mut void; | --------- first mutable borrow occurs here -LL | let second = &mut void; //~ ERROR cannot borrow +LL | let second = &mut void; | ^^^^^^^^^ second mutable borrow occurs here LL | first.use_mut(); | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `inner_void` as mutable more than once at a time | LL | let inner_first = &mut inner_void; | --------------- first mutable borrow occurs here -LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow +LL | let inner_second = &mut inner_void; | ^^^^^^^^^^^^^^^ second mutable borrow occurs here LL | inner_second.use_mut(); LL | inner_first.use_mut(); diff --git a/src/test/ui/borrowck/mutability-errors.nll.stderr b/src/test/ui/borrowck/mutability-errors.nll.stderr index 6dd3582f95f..11bc7889443 100644 --- a/src/test/ui/borrowck/mutability-errors.nll.stderr +++ b/src/test/ui/borrowck/mutability-errors.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `&` reference @@ -11,8 +11,8 @@ error[E0594]: cannot assign to `x.0` which is behind a `&` reference | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` -LL | *x = (1,); //~ ERROR -LL | x.0 = 1; //~ ERROR +LL | *x = (1,); +LL | x.0 = 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -21,7 +21,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference @@ -30,31 +30,31 @@ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/mutability-errors.rs:16:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/mutability-errors.rs:17:5 | -LL | f().0 = 1; //~ ERROR +LL | f().0 = 1; | ^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/mutability-errors.rs:18:5 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/mutability-errors.rs:19:5 | -LL | &mut f().0; //~ ERROR +LL | &mut f().0; | ^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `*x` which is behind a `*const` pointer @@ -62,7 +62,7 @@ error[E0594]: cannot assign to `*x` which is behind a `*const` pointer | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer @@ -70,8 +70,8 @@ error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` -LL | *x = (1,); //~ ERROR -LL | (*x).0 = 1; //~ ERROR +LL | *x = (1,); +LL | (*x).0 = 1; | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer @@ -80,7 +80,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer @@ -89,37 +89,37 @@ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` ... -LL | &mut (*x).0; //~ ERROR +LL | &mut (*x).0; | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `*const` pointer --> $DIR/mutability-errors.rs:30:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `*const` pointer --> $DIR/mutability-errors.rs:31:5 | -LL | (*f()).0 = 1; //~ ERROR +LL | (*f()).0 = 1; | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `*const` pointer as mutable --> $DIR/mutability-errors.rs:32:5 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `*const` pointer as mutable --> $DIR/mutability-errors.rs:33:5 | -LL | &mut (*f()).0; //~ ERROR +LL | &mut (*f()).0; | ^^^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:40:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -127,17 +127,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:41:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -145,17 +145,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:42:9 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -163,17 +163,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:43:9 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -181,17 +181,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:46:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -199,17 +199,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:47:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -217,17 +217,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:48:9 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -235,17 +235,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:49:9 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -253,10 +253,10 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ @@ -265,7 +265,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable @@ -273,8 +273,8 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | &mut x; //~ ERROR -LL | &mut x.0; //~ ERROR +LL | &mut x; +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -282,7 +282,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | || { //~ ERROR +LL | || { LL | x = (1,); | ^^^^^^^^ cannot assign @@ -319,7 +319,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable @@ -328,7 +328,7 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -337,7 +337,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable @@ -346,31 +346,31 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable static item `X` --> $DIR/mutability-errors.rs:76:5 | -LL | X = (1,); //~ ERROR +LL | X = (1,); | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item --> $DIR/mutability-errors.rs:77:5 | -LL | X.0 = 1; //~ ERROR +LL | X.0 = 1; | ^^^^^^^ cannot assign error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/mutability-errors.rs:78:5 | -LL | &mut X; //~ ERROR +LL | &mut X; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item --> $DIR/mutability-errors.rs:79:5 | -LL | &mut X.0; //~ ERROR +LL | &mut X.0; | ^^^^^^^^ cannot borrow as mutable error: aborting due to 38 previous errors diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr index 66e3c4056a2..60af4123735 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:6:5 | -LL | let ref mut x = 1234543; //~ ERROR +LL | let ref mut x = 1234543; | ------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function @@ -9,7 +9,7 @@ LL | x error[E0515]: cannot return value referencing temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:11:5 | -LL | let (ref mut x, ) = (1234543, ); //~ ERROR +LL | let (ref mut x, ) = (1234543, ); | ----------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function @@ -21,7 +21,7 @@ LL | match 1234543 { | ^ ------- temporary value created here | _____| | | -LL | | ref mut x => x //~ ERROR +LL | | ref mut x => x LL | | } | |_____^ returns a value referencing data owned by the current function @@ -32,14 +32,14 @@ LL | match (123443,) { | ^ --------- temporary value created here | _____| | | -LL | | (ref mut x,) => x, //~ ERROR +LL | | (ref mut x,) => x, LL | | } | |_____^ returns a value referencing data owned by the current function error[E0515]: cannot return reference to temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5 | -LL | &mut 1234543 //~ ERROR +LL | &mut 1234543 | ^^^^^------- | | | | | temporary value created here diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr index bf9084259c8..d455a8f0787 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr @@ -1,13 +1,13 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:7:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:15:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr index 53b51eb894a..5f1313f286e 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields_overlapping.rs:12:5 | -LL | x.a = 1; //~ ERROR +LL | x.a = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable @@ -9,8 +9,8 @@ error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable | LL | let x: Foo; | - help: consider changing this to be mutable: `mut x` -LL | x.a = 1; //~ ERROR -LL | x.b = 22; //~ ERROR +LL | x.a = 1; +LL | x.b = 22; | ^^^^^^^^ cannot assign error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr index 910b8292ec8..553ee24cca2 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr @@ -4,13 +4,13 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` LL | x = (22, 44); -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields_twice.rs:12:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr index 4b4a989368a..8b531474553 100644 --- a/src/test/ui/by-move-pattern-binding.nll.stderr +++ b/src/test/ui/by-move-pattern-binding.nll.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of borrowed content LL | match &s.x { | ^^^^ cannot move out of borrowed content LL | &E::Foo => {} -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ------------------- | | | | | data moved here @@ -13,7 +13,7 @@ LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait --> $DIR/by-move-pattern-binding.rs:16:17 | -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr index f1a23124908..fe014fa1059 100644 --- a/src/test/ui/check-static-values-constraints.nll.stderr +++ b/src/test/ui/check-static-values-constraints.nll.stderr @@ -3,7 +3,7 @@ error[E0493]: destructors cannot be evaluated at compile-time | LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), | ___________________________________________^ -LL | | //~^ ERROR destructors cannot be evaluated at compile-time +LL | | LL | | field2: SafeEnum::Variant1}}; | |________________________________________________________________________________^ statics cannot evaluate destructors @@ -28,49 +28,49 @@ LL | field2: SafeEnum::Variant4("str".to_string()) error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:95:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:95:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:97:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:97:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:102:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:102:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:104:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:104:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics diff --git a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr index 0c4d90f4c53..7e60f3cd8ff 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr +++ b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `y`, as it is not declared as mutable | LL | let y = true; | - help: consider changing this to be mutable: `mut y` -LL | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable +LL | foo(Box::new(move || y = false) as Box<_>); | ^^^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr index 7fdeb03acbd..a60f1c77a58 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = "foo"; | - help: consider changing this to be mutable: `mut x` ... -LL | let y = &mut x; //~ ERROR cannot borrow +LL | let y = &mut x; | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/issue-11715.nll.stderr b/src/test/ui/codemap_tests/issue-11715.nll.stderr index 9f30f385425..d0c29c768eb 100644 --- a/src/test/ui/codemap_tests/issue-11715.nll.stderr +++ b/src/test/ui/codemap_tests/issue-11715.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here LL | z.use_mut(); LL | y.use_mut(); diff --git a/src/test/ui/codemap_tests/one_line.nll.stderr b/src/test/ui/codemap_tests/one_line.nll.stderr index 0eb257c5976..eddbd29c0ef 100644 --- a/src/test/ui/codemap_tests/one_line.nll.stderr +++ b/src/test/ui/codemap_tests/one_line.nll.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/one_line.rs:3:12 | -LL | v.push(v.pop().unwrap()); //~ ERROR cannot borrow +LL | v.push(v.pop().unwrap()); | - ---- ^ second mutable borrow occurs here | | | | | first borrow later used by call diff --git a/src/test/ui/codemap_tests/tab_3.nll.stderr b/src/test/ui/codemap_tests/tab_3.nll.stderr index 3b8507a067d..97816a76004 100644 --- a/src/test/ui/codemap_tests/tab_3.nll.stderr +++ b/src/test/ui/codemap_tests/tab_3.nll.stderr @@ -6,7 +6,7 @@ LL | let some_vec = vec!["hi"]; LL | some_vec.into_iter(); | -------- value moved here LL | { -LL | println!("{:?}", some_vec); //~ ERROR use of moved +LL | println!("{:?}", some_vec); | ^^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr index 238db527e38..ca80a9ab391 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr @@ -1,7 +1,7 @@ error: `foo` is not yet stable as a const fn --> $DIR/dont_promote_unstable_const_fn.rs:15:25 | -LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn +LL | const fn bar() -> u32 { foo() } | ^^^^^ | = help: add `#![feature(foo)]` to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a cons error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:18:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -19,7 +19,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:22:28 | -LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &meh(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,7 +34,7 @@ LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr index 4355401987b..129f0615107 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29 | -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr index a2a71fc2ce3..519ba7d84b0 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_const_fn_fail.rs:20:27 | -LL | let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough +LL | let x: &'static u8 = &(bar() + 1); | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr index 117090d89fd..a8bb6976da7 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:6:30 | -LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough +LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,18 +23,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:7:28 | -LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:8:29 | -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr index 90fe7eebe4a..5aae8c12d16 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr @@ -5,7 +5,7 @@ LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR value does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-eval/union_promotion.nll.stderr b/src/test/ui/consts/const-eval/union_promotion.nll.stderr index 11bc7f9da35..b530c02f2fb 100644 --- a/src/test/ui/consts/const-eval/union_promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/union_promotion.rs:9:29 | -LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough +LL | let x: &'static bool = &unsafe { | ____________-------------____^ | | | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-conversion.nll.stderr b/src/test/ui/consts/const-int-conversion.nll.stderr index afc051013ed..65330e282c9 100644 --- a/src/test/ui/consts/const-int-conversion.nll.stderr +++ b/src/test/ui/consts/const-int-conversion.nll.stderr @@ -71,7 +71,7 @@ LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-int-overflowing.nll.stderr b/src/test/ui/consts/const-int-overflowing.nll.stderr index ffcac69c1af..bd061ab3331 100644 --- a/src/test/ui/consts/const-int-overflowing.nll.stderr +++ b/src/test/ui/consts/const-int-overflowing.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:2:36 | -LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough +LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,18 +12,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:3:36 | -LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:4:36 | -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-rotate.nll.stderr b/src/test/ui/consts/const-int-rotate.nll.stderr index 9923096f46d..2b7cdf5746e 100644 --- a/src/test/ui/consts/const-int-rotate.nll.stderr +++ b/src/test/ui/consts/const-int-rotate.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.rotate_left(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-sign.nll.stderr b/src/test/ui/consts/const-int-sign.nll.stderr index 43fd002ff3a..0ad7a39d595 100644 --- a/src/test/ui/consts/const-int-sign.nll.stderr +++ b/src/test/ui/consts/const-int-sign.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:2:29 | -LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough +LL | let x: &'static bool = &(5_i32.is_negative()); | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:3:29 | -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-wrapping.nll.stderr b/src/test/ui/consts/const-int-wrapping.nll.stderr index 036c8b9d95e..a186854ce0c 100644 --- a/src/test/ui/consts/const-int-wrapping.nll.stderr +++ b/src/test/ui/consts/const-int-wrapping.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,7 +23,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:4:28 | -LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,18 +34,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:5:28 | -LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough +LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:6:28 | -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-ptr-nonnull.nll.stderr b/src/test/ui/consts/const-ptr-nonnull.nll.stderr index 6977e7fdc11..26946fb9902 100644 --- a/src/test/ui/consts/const-ptr-nonnull.nll.stderr +++ b/src/test/ui/consts/const-ptr-nonnull.nll.stderr @@ -16,7 +16,7 @@ LL | let x: &'static NonNull<u32> = &(non_null.cast()); | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-ptr-unique.nll.stderr b/src/test/ui/consts/const-ptr-unique.nll.stderr index b201994c894..3644cf4cec7 100644 --- a/src/test/ui/consts/const-ptr-unique.nll.stderr +++ b/src/test/ui/consts/const-ptr-unique.nll.stderr @@ -5,7 +5,7 @@ LL | let x: &'static *mut u32 = &(unique.as_ptr()); | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index feb4960e0c7..95b809712ff 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -1,7 +1,7 @@ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:37:25 | -LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -15,7 +15,7 @@ LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:44:28 | -LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner_lt(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -29,7 +29,7 @@ LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:51:27 | -LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors +LL | const fn into_inner_s(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -99,7 +99,7 @@ LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:90:27 | -LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn +LL | const fn foo25() -> u32 { BAR } | ^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -107,7 +107,7 @@ LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in c error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:91:36 | -LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items +LL | const fn foo26() -> &'static u32 { &BAR } | ^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -155,7 +155,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563) --> $DIR/min_const_fn.rs:102:29 | -LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn +LL | const fn foo30_5(b: bool) { while b { } } | ^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -227,7 +227,7 @@ LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {} error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:133:22 | -LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -235,7 +235,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other error[E0723]: `impl Trait` in const fn is unstable (see issue #57563) --> $DIR/min_const_fn.rs:134:23 | -LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable +LL | const fn no_rpit() -> impl std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -243,7 +243,7 @@ LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in con error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:135:23 | -LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/promotion.nll.stderr b/src/test/ui/consts/min_const_fn/promotion.nll.stderr index eb186ce4951..550423c2d93 100644 --- a/src/test/ui/consts/min_const_fn/promotion.nll.stderr +++ b/src/test/ui/consts/min_const_fn/promotion.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:11:27 | -LL | let x: &'static () = &foo1(); //~ ERROR does not live long enough +LL | let x: &'static () = &foo1(); | ----------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:12:28 | -LL | let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough +LL | let y: &'static i32 = &foo2(42); | ------------ ^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,7 +23,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:13:28 | -LL | let z: &'static i32 = &foo3(); //~ ERROR does not live long enough +LL | let z: &'static i32 = &foo3(); | ------------ ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,7 +34,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:14:34 | -LL | let a: &'static Cell<i32> = &foo4(); //~ ERROR does not live long enough +LL | let a: &'static Cell<i32> = &foo4(); | ------------------ ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -45,18 +45,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:15:42 | -LL | let a: &'static Option<Cell<i32>> = &foo5(); //~ ERROR does not live long enough +LL | let a: &'static Option<Cell<i32>> = &foo5(); | -------------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let a: &'static Option<Cell<i32>> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option<Cell<i32>> = &foo6(); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:16:42 | -LL | let a: &'static Option<Cell<i32>> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option<Cell<i32>> = &foo6(); | -------------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/promote_const_let.nll.stderr b/src/test/ui/consts/promote_const_let.nll.stderr index e6ee1523a3b..a0af949bf71 100644 --- a/src/test/ui/consts/promote_const_let.nll.stderr +++ b/src/test/ui/consts/promote_const_let.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `y` does not live long enough LL | let x: &'static u32 = { | ------------ type annotation requires that `y` is borrowed for `'static` LL | let y = 42; -LL | &y //~ ERROR does not live long enough +LL | &y | ^^ borrowed value does not live long enough LL | }; | - `y` dropped here while still borrowed @@ -12,7 +12,7 @@ LL | }; error[E0716]: temporary value dropped while borrowed --> $DIR/promote_const_let.rs:6:28 | -LL | let x: &'static u32 = &{ //~ ERROR does not live long enough +LL | let x: &'static u32 = &{ | ____________------------____^ | | | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/did_you_mean/issue-31424.nll.stderr b/src/test/ui/did_you_mean/issue-31424.nll.stderr index 91368dded37..147225f1be5 100644 --- a/src/test/ui/did_you_mean/issue-31424.nll.stderr +++ b/src/test/ui/did_you_mean/issue-31424.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-31424.rs:7:9 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^^^^^^^^ | | | cannot borrow as mutable @@ -12,8 +12,8 @@ warning: function cannot return without recursing | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | +LL | (&mut self).bar(); | ----------------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -22,7 +22,7 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-31424.rs:14:9 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^^^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-34126.nll.stderr b/src/test/ui/did_you_mean/issue-34126.nll.stderr index ed73cca435f..e738df1b732 100644 --- a/src/test/ui/did_you_mean/issue-34126.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34126.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-34126.rs:6:18 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ^^^^^^^^^ | | | cannot borrow as mutable @@ -10,7 +10,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable --> $DIR/issue-34126.rs:6:18 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ---- --- ^^^^^^^^^ mutable borrow occurs here | | | | | immutable borrow later used by call diff --git a/src/test/ui/did_you_mean/issue-34337.nll.stderr b/src/test/ui/did_you_mean/issue-34337.nll.stderr index 5e46889866d..81f7b6dbf1b 100644 --- a/src/test/ui/did_you_mean/issue-34337.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34337.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `key` as mutable, as it is not declared as mutable --> $DIR/issue-34337.rs:6:9 | -LL | get(&mut key); //~ ERROR cannot borrow +LL | get(&mut key); | ^^^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr index 76fb1e22953..216cb14dcf6 100644 --- a/src/test/ui/did_you_mean/issue-35937.nll.stderr +++ b/src/test/ui/did_you_mean/issue-35937.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable | LL | let f = Foo { v: Vec::new() }; | - help: consider changing this to be mutable: `mut f` -LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow +LL | f.v.push("cat".to_string()); | ^^^ cannot borrow as mutable error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable @@ -11,7 +11,7 @@ error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable | LL | let s = S { x: 42 }; | - help: consider changing this to be mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable @@ -19,7 +19,7 @@ error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable | LL | fn bar(s: S) { | - help: consider changing this to be mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot assign error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-37139.nll.stderr b/src/test/ui/did_you_mean/issue-37139.nll.stderr index 4d1c8a6b0eb..163817dd9bf 100644 --- a/src/test/ui/did_you_mean/issue-37139.nll.stderr +++ b/src/test/ui/did_you_mean/issue-37139.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/issue-37139.rs:12:18 | -LL | test(&mut x); //~ ERROR cannot borrow immutable +LL | test(&mut x); | ^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr index 838673b21d1..6efac371c02 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc | LL | fn f(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | self.s.push('x'); //~ ERROR cannot borrow data mutably +LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr index 458e41f6aae..db3e6b89426 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference | LL | fn f(x: usize, f: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>` -LL | f.s.push('x'); //~ ERROR cannot borrow data mutably +LL | f.s.push('x'); | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-39544.nll.stderr b/src/test/ui/did_you_mean/issue-39544.nll.stderr index 2fb8e3db68c..899a42b54e6 100644 --- a/src/test/ui/did_you_mean/issue-39544.nll.stderr +++ b/src/test/ui/did_you_mean/issue-39544.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable | LL | let z = Z { x: X::Y }; | - help: consider changing this to be mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo<'z>(&'z self) { | -------- help: consider changing this to be a mutable reference: `&'z mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo1(&self, other: &Z) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -27,8 +27,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo1(&self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -36,7 +36,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo2<'a>(&'a self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -44,8 +44,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo2<'a>(&'a self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -53,7 +53,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut Self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -61,8 +61,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -70,7 +70,7 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo4(other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable @@ -78,7 +78,7 @@ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable | LL | pub fn with_arg(z: Z, w: &Z) { | - help: consider changing this to be mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference @@ -86,8 +86,8 @@ error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference | LL | pub fn with_arg(z: Z, w: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow -LL | let _ = &mut w.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; +LL | let _ = &mut w.x; | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to `*x.0` which is behind a `&` reference diff --git a/src/test/ui/did_you_mean/issue-40823.nll.stderr b/src/test/ui/did_you_mean/issue-40823.nll.stderr index 0389cf5499d..73473406a9a 100644 --- a/src/test/ui/did_you_mean/issue-40823.nll.stderr +++ b/src/test/ui/did_you_mean/issue-40823.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference | LL | let mut buf = &[1, 2, 3, 4]; | ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]` -LL | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content +LL | buf.iter_mut(); | ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr index 59cb804a801..fff3a64ff29 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:22 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | - ^ cannot move out of here | | | data moved here @@ -9,7 +9,7 @@ LL | let X { x: y } = x; //~ ERROR cannot move out of type note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:16 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | ^ error: aborting due to previous error diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr index 9c6c9341be7..7fed27adaff 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let b: Vec<&str> = a.lines().collect(); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` because it is borrowed +LL | drop(a); | ^ move out of `a` occurs here LL | for s in &b { | -- borrow later used here diff --git a/src/test/ui/dropck/dropck-union.nll.stderr b/src/test/ui/dropck/dropck-union.nll.stderr index 667bb7221aa..228744326f9 100644 --- a/src/test/ui/dropck/dropck-union.nll.stderr +++ b/src/test/ui/dropck/dropck-union.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `v` does not live long enough --> $DIR/dropck-union.rs:39:18 | -LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough +LL | v.0.set(Some(&v)); | ^^ borrowed value does not live long enough LL | } | - diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr index 28b9656c6fd..8c669b597c3 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `o2` does not live long enough | LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o1.set0(&o2); | ^^^ borrowed value does not live long enough ... LL | } @@ -14,8 +14,8 @@ error[E0597]: `o3` does not live long enough | LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough -LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o1.set0(&o2); +LL | o1.set1(&o3); | ^^^ borrowed value does not live long enough ... LL | } @@ -27,7 +27,7 @@ error[E0597]: `o2` does not live long enough LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` ... -LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o2.set0(&o2); | ^^^ borrowed value does not live long enough ... LL | } @@ -39,7 +39,7 @@ error[E0597]: `o3` does not live long enough LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` ... -LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o2.set1(&o3); | ^^^ borrowed value does not live long enough ... LL | } @@ -51,9 +51,9 @@ error[E0597]: `o1` does not live long enough LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); | -------- cast requires that `o1` is borrowed for `'static` ... -LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough +LL | o3.set0(&o1); | ^^^ borrowed value does not live long enough -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); LL | } | - `o1` dropped here while still borrowed @@ -63,7 +63,7 @@ error[E0597]: `o2` does not live long enough LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` ... -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); | ^^^ borrowed value does not live long enough LL | } | - `o2` dropped here while still borrowed diff --git a/src/test/ui/dst/dst-bad-coerce3.nll.stderr b/src/test/ui/dst/dst-bad-coerce3.nll.stderr index 8f1289845e3..289d451f02a 100644 --- a/src/test/ui/dst/dst-bad-coerce3.nll.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat<[isize; 3]> = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat<[isize]> = f2; | ---------------- type annotation requires that `f1` is borrowed for `'a` @@ -18,7 +18,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &Fat<Foo> = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat<Foo> = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat<Bar> = f2; | ------------ type annotation requires that `f1` is borrowed for `'a` @@ -32,7 +32,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &([isize; 3],) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a ([isize],) = f2; | -------------- type annotation requires that `f1` is borrowed for `'a` @@ -46,7 +46,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &(Foo,) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a (Bar,) = f2; | ---------- type annotation requires that `f1` is borrowed for `'a` diff --git a/src/test/ui/error-codes/E0017.nll.stderr b/src/test/ui/error-codes/E0017.nll.stderr index 0477f06010b..3c2a07265f4 100644 --- a/src/test/ui/error-codes/E0017.nll.stderr +++ b/src/test/ui/error-codes/E0017.nll.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0017.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0301.nll.stderr b/src/test/ui/error-codes/E0301.nll.stderr index 898c30a75b2..24234c9929e 100644 --- a/src/test/ui/error-codes/E0301.nll.stderr +++ b/src/test/ui/error-codes/E0301.nll.stderr @@ -1,7 +1,7 @@ error[E0301]: cannot mutably borrow in a pattern guard --> $DIR/E0301.rs:4:19 | -LL | option if option.take().is_none() => {}, //~ ERROR E0301 +LL | option if option.take().is_none() => {}, | ^^^^^^ borrowed mutably in pattern guard | = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable diff --git a/src/test/ui/error-codes/E0388.nll.stderr b/src/test/ui/error-codes/E0388.nll.stderr index a898d60a985..0fc8a76820c 100644 --- a/src/test/ui/error-codes/E0388.nll.stderr +++ b/src/test/ui/error-codes/E0388.nll.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0388.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr index 13d2f8cfaa5..c47750b6f4e 100644 --- a/src/test/ui/error-codes/E0389.nll.stderr +++ b/src/test/ui/error-codes/E0389.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` -LL | fancy_ref.num = 6; //~ ERROR E0389 +LL | fancy_ref.num = 6; | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0499.nll.stderr b/src/test/ui/error-codes/E0499.nll.stderr index c1acef10e6e..d56baf72272 100644 --- a/src/test/ui/error-codes/E0499.nll.stderr +++ b/src/test/ui/error-codes/E0499.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time | LL | let mut x = &mut i; | ------ first mutable borrow occurs here -LL | let mut a = &mut i; //~ ERROR E0499 +LL | let mut a = &mut i; | ^^^^^^ second mutable borrow occurs here LL | a.use_mut(); LL | x.use_mut(); diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr index 64ca8f0e6b9..cade6d71852 100644 --- a/src/test/ui/error-codes/E0502.nll.stderr +++ b/src/test/ui/error-codes/E0502.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immut | LL | let ref y = a; | ----- immutable borrow occurs here -LL | bar(a); //~ ERROR E0502 +LL | bar(a); | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/error-codes/E0503.nll.stderr b/src/test/ui/error-codes/E0503.nll.stderr index 7b483a5eaa5..106dda2bc22 100644 --- a/src/test/ui/error-codes/E0503.nll.stderr +++ b/src/test/ui/error-codes/E0503.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed | LL | let _borrow = &mut value; | ---------- borrow of `value` occurs here -LL | let _sum = value + 1; //~ ERROR E0503 +LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` LL | _borrow.use_mut(); | ------- borrow later used here diff --git a/src/test/ui/error-codes/E0504.nll.stderr b/src/test/ui/error-codes/E0504.nll.stderr index 8d7387e86e5..1f2a0407a39 100644 --- a/src/test/ui/error-codes/E0504.nll.stderr +++ b/src/test/ui/error-codes/E0504.nll.stderr @@ -6,7 +6,7 @@ LL | let fancy_ref = &fancy_num; LL | LL | let x = move || { | ^^^^^^^ move out of `fancy_num` occurs here -LL | println!("child function: {}", fancy_num.num); //~ ERROR E0504 +LL | println!("child function: {}", fancy_num.num); | --------- move occurs due to use in closure ... LL | println!("main function: {}", fancy_ref.num); diff --git a/src/test/ui/error-codes/E0505.nll.stderr b/src/test/ui/error-codes/E0505.nll.stderr index 181e5e33d29..4d9d1ef121c 100644 --- a/src/test/ui/error-codes/E0505.nll.stderr +++ b/src/test/ui/error-codes/E0505.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let _ref_to_val: &Value = &x; | -- borrow of `x` occurs here -LL | eat(x); //~ ERROR E0505 +LL | eat(x); | ^ move out of `x` occurs here LL | _ref_to_val.use_ref(); | ----------- borrow later used here diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr index 0233c7d6d16..e5c0cf6e24e 100644 --- a/src/test/ui/error-codes/E0509.nll.stderr +++ b/src/test/ui/error-codes/E0509.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait --> $DIR/E0509.rs:16:23 | -LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 +LL | let fancy_field = drop_struct.fancy; | ^^^^^^^^^^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/error-codes/E0597.nll.stderr b/src/test/ui/error-codes/E0597.nll.stderr index 88a8a46930d..b4a1180ad54 100644 --- a/src/test/ui/error-codes/E0597.nll.stderr +++ b/src/test/ui/error-codes/E0597.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | x.x = Some(&y); | ^^ borrowed value does not live long enough -LL | //~^ `y` does not live long enough [E0597] +LL | LL | } | - | | diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr index 67cca25ac0c..e7b45753421 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `A`, which implements the `Drop` trait --> $DIR/functional-struct-update-noncopyable.rs:12:14 | -LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A` +LL | let _b = A { y: Arc::new(3), ..a }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here error: aborting due to previous error diff --git a/src/test/ui/generator/borrowing.nll.stderr b/src/test/ui/generator/borrowing.nll.stderr index 3c9221d28e7..3d58873f826 100644 --- a/src/test/ui/generator/borrowing.nll.stderr +++ b/src/test/ui/generator/borrowing.nll.stderr @@ -7,7 +7,7 @@ LL | Pin::new(&mut || yield &a).resume() | | borrowed value does not live long enough | value captured here by generator | a temporary with access to the borrow is created here ... -LL | //~^ ERROR: `a` does not live long enough +LL | LL | }; | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator | | diff --git a/src/test/ui/generator/dropck.nll.stderr b/src/test/ui/generator/dropck.nll.stderr index a90a47fe9aa..8bb860f288f 100644 --- a/src/test/ui/generator/dropck.nll.stderr +++ b/src/test/ui/generator/dropck.nll.stderr @@ -18,7 +18,7 @@ error[E0597]: `ref_` does not live long enough LL | gen = || { | -- value captured here by generator LL | // but the generator can use it to drop a `Ref<'a, i32>`. -LL | let _d = ref_.take(); //~ ERROR `ref_` does not live long enough +LL | let _d = ref_.take(); | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/generator/yield-in-args.nll.stderr b/src/test/ui/generator/yield-in-args.nll.stderr index f753daafa97..ee6d22c27cd 100644 --- a/src/test/ui/generator/yield-in-args.nll.stderr +++ b/src/test/ui/generator/yield-in-args.nll.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-in-args.rs:8:13 | -LL | foo(&b, yield); //~ ERROR +LL | foo(&b, yield); | ^^ ----- possible yield occurs here error: aborting due to previous error diff --git a/src/test/ui/generator/yield-while-iterating.nll.stderr b/src/test/ui/generator/yield-while-iterating.nll.stderr index 2dc12f843b2..43e29ceb5e6 100644 --- a/src/test/ui/generator/yield-while-iterating.nll.stderr +++ b/src/test/ui/generator/yield-while-iterating.nll.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-while-iterating.rs:13:18 | -LL | for p in &x { //~ ERROR +LL | for p in &x { | ^^ LL | yield(); | ------- possible yield occurs here @@ -14,7 +14,7 @@ LL | let mut b = || { LL | for p in &mut x { | - first borrow occurs due to use of `x` in generator ... -LL | println!("{}", x[0]); //~ ERROR +LL | println!("{}", x[0]); | ^ immutable borrow occurs here LL | Pin::new(&mut b).resume(); | ------ mutable borrow later used here diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr index d0d6a98301e..4c37cd35173 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr @@ -6,7 +6,7 @@ LL | let mut b = || { LL | let a = &mut *x; | - first borrow occurs due to use of `x` in generator ... -LL | println!("{}", x); //~ ERROR +LL | println!("{}", x); | ^ second borrow occurs here LL | Pin::new(&mut b).resume(); | ------ first borrow later used here diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr index cff58af3775..f7626b13bad 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr +++ b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as LL | let (_, thing) = my_stuff.iter().next().unwrap(); | -------- immutable borrow occurs here LL | -LL | my_stuff.clear(); //~ ERROR cannot borrow +LL | my_stuff.clear(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | LL | println!("{}", *thing); diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr index 08b8e3e443a..497c7d1216c 100644 --- a/src/test/ui/hashmap-lifetimes.nll.stderr +++ b/src/test/ui/hashmap-lifetimes.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as | LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here -LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow +LL | my_stuff.insert(1, 43); | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | it; | -- immutable borrow later used here diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr index 80ecc4741a2..70d5b3c2ec5 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | foo.insert(); | --- first mutable borrow occurs here -LL | foo.insert(); //~ ERROR cannot borrow +LL | foo.insert(); | ^^^ | | | second mutable borrow occurs here diff --git a/src/test/ui/hygiene/fields-move.nll.stderr b/src/test/ui/hygiene/fields-move.nll.stderr index f72a52e2535..562f60e31b5 100644 --- a/src/test/ui/hygiene/fields-move.nll.stderr +++ b/src/test/ui/hygiene/fields-move.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:18:9 | -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ^^^^^^ value used here after move ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ----- value moved here -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ----------------- in this macro invocation | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -17,7 +17,7 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -25,10 +25,10 @@ LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved val error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:29:42 | -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr index 3f5dbb850cc..f96ff9dd4e6 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `p` because it is borrowed | LL | let r = foo(&p); | -- borrow of `p` occurs here -LL | p += 1; //~ ERROR cannot assign to `p` because it is borrowed +LL | p += 1; | ^^^^^^ assignment to borrowed `p` occurs here LL | println!("{}", r); | - borrow later used here diff --git a/src/test/ui/issues/issue-11681.nll.stderr b/src/test/ui/issues/issue-11681.nll.stderr index a3c71ffe95a..f2f93076671 100644 --- a/src/test/ui/issues/issue-11681.nll.stderr +++ b/src/test/ui/issues/issue-11681.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/issue-11681.rs:13:10 | -LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough +LL | let testValue = &Test; | ---- temporary value created here LL | return testValue; | ^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/issues/issue-11873.nll.stderr b/src/test/ui/issues/issue-11873.nll.stderr index e5abf074202..4475bdf1474 100644 --- a/src/test/ui/issues/issue-11873.nll.stderr +++ b/src/test/ui/issues/issue-11873.nll.stderr @@ -5,7 +5,7 @@ LL | let mut f = || v.push(2); | -- - borrow occurs due to use in closure | | | borrow of `v` occurs here -LL | let _w = v; //~ ERROR: cannot move out of `v` +LL | let _w = v; | ^ move out of `v` occurs here LL | LL | f(); diff --git a/src/test/ui/issues/issue-12470.nll.stderr b/src/test/ui/issues/issue-12470.nll.stderr index 27878e7718b..c97e59195ed 100644 --- a/src/test/ui/issues/issue-12470.nll.stderr +++ b/src/test/ui/issues/issue-12470.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*b` --> $DIR/issue-12470.rs:29:5 | -LL | let bb: &B = &*b; //~ ERROR does not live long enough +LL | let bb: &B = &*b; | --- `*b` is borrowed here LL | make_a(bb) | ^^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/issues/issue-13497-2.nll.stderr b/src/test/ui/issues/issue-13497-2.nll.stderr index fb0d606690d..8ad921027e2 100644 --- a/src/test/ui/issues/issue-13497-2.nll.stderr +++ b/src/test/ui/issues/issue-13497-2.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `rawLines` --> $DIR/issue-13497-2.rs:3:5 | -LL | rawLines //~ ERROR `rawLines` does not live long enough +LL | rawLines | ^------- | | | _____`rawLines` is borrowed here diff --git a/src/test/ui/issues/issue-17385.nll.stderr b/src/test/ui/issues/issue-17385.nll.stderr index 20198f19dd5..28c22260c38 100644 --- a/src/test/ui/issues/issue-17385.nll.stderr +++ b/src/test/ui/issues/issue-17385.nll.stderr @@ -5,7 +5,7 @@ LL | let foo = X(1); | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait LL | drop(foo); | --- value moved here -LL | match foo { //~ ERROR use of moved value +LL | match foo { LL | X(1) => (), | ^ value used here after move @@ -16,7 +16,7 @@ LL | let e = Enum::Variant2; | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait LL | drop(e); | - value moved here -LL | match e { //~ ERROR use of moved value +LL | match e { | ^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr index 527f8df9ccb..79a1e09bd7c 100644 --- a/src/test/ui/issues/issue-17545.nll.stderr +++ b/src/test/ui/issues/issue-17545.nll.stderr @@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) { | -- lifetime `'a` defined here LL | / bar.call(( -LL | | &id(()), //~ ERROR borrowed value does not live long enough +LL | | &id(()), | | ^^^^^^ creates a temporary which is freed while still in use LL | | )); | | -- temporary value is freed at the end of this statement diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr index 86e7a184910..c3e6267d30f 100644 --- a/src/test/ui/issues/issue-17718-static-move.nll.stderr +++ b/src/test/ui/issues/issue-17718-static-move.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-17718-static-move.rs:6:14 | -LL | let _a = FOO; //~ ERROR: cannot move out of static item +LL | let _a = FOO; | ^^^ | | | cannot move out of static item diff --git a/src/test/ui/issues/issue-18118.nll.stderr b/src/test/ui/issues/issue-18118.nll.stderr index 1920e1637d1..49798a148de 100644 --- a/src/test/ui/issues/issue-18118.nll.stderr +++ b/src/test/ui/issues/issue-18118.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `p` does not live long enough --> $DIR/issue-18118.rs:4:9 | -LL | &p //~ ERROR `p` does not live long enough +LL | &p | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-18783.nll.stderr b/src/test/ui/issues/issue-18783.nll.stderr index f49a2d7a2b2..047b42578a2 100644 --- a/src/test/ui/issues/issue-18783.nll.stderr +++ b/src/test/ui/issues/issue-18783.nll.stderr @@ -9,7 +9,7 @@ LL | c.push(Box::new(|| y = 0)); | ^^ - second borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>` @@ -24,7 +24,7 @@ LL | Push::push(&c, Box::new(|| y = 0)); | ^^ - second borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>` diff --git a/src/test/ui/issues/issue-21600.nll.stderr b/src/test/ui/issues/issue-21600.nll.stderr index 05837e92cdb..21f3774c056 100644 --- a/src/test/ui/issues/issue-21600.nll.stderr +++ b/src/test/ui/issues/issue-21600.nll.stderr @@ -1,19 +1,19 @@ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/issue-21600.rs:14:20 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^ - mutable borrow occurs due to use of `x` in closure | | | cannot borrow as mutable @@ -24,8 +24,8 @@ help: consider changing this to accept closures that implement `FnMut` LL | call_it(|| { | _____________^ LL | | call_it(|| x.gen()); -LL | | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer -LL | | //~^ ERROR cannot borrow data mutably in a captured outer +LL | | call_it(|| x.gen_mut()); +LL | | LL | | }); | |_____^ diff --git a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr index 52e637a3f0b..3b4f27621f6 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr +++ b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr @@ -1,13 +1,13 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:12:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:18:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-24357.nll.stderr b/src/test/ui/issues/issue-24357.nll.stderr index 310535434cd..a9c43a8f0d9 100644 --- a/src/test/ui/issues/issue-24357.nll.stderr +++ b/src/test/ui/issues/issue-24357.nll.stderr @@ -7,7 +7,7 @@ LL | let f = move || { let y = x; }; | ------- - variable moved due to use in closure | | | value moved into closure here -LL | //~^ NOTE value moved (into closure) here +LL | LL | let z = x; | ^ value used here after move diff --git a/src/test/ui/issues/issue-25700.nll.stderr b/src/test/ui/issues/issue-25700.nll.stderr index ba5403cca4d..fa309a55c3c 100644 --- a/src/test/ui/issues/issue-25700.nll.stderr +++ b/src/test/ui/issues/issue-25700.nll.stderr @@ -5,7 +5,7 @@ LL | let t = S::<()>(None); | - move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait LL | drop(t); | - value moved here -LL | drop(t); //~ ERROR use of moved value +LL | drop(t); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr index 1252578419a..e19e83dc747 100644 --- a/src/test/ui/issues/issue-2590.nll.stderr +++ b/src/test/ui/issues/issue-2590.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-2590.rs:11:9 | -LL | self.tokens //~ ERROR cannot move out of borrowed content +LL | self.tokens | ^^^^^^^^^^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36400.nll.stderr b/src/test/ui/issues/issue-36400.nll.stderr index e260fab7791..3b37578f3c4 100644 --- a/src/test/ui/issues/issue-36400.nll.stderr +++ b/src/test/ui/issues/issue-36400.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable | LL | let x = Box::new(3); | - help: consider changing this to be mutable: `mut x` -LL | f(&mut *x); //~ ERROR cannot borrow immutable +LL | f(&mut *x); | ^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40288.nll.stderr b/src/test/ui/issues/issue-40288.nll.stderr index bb4110948d5..fb4ecab362d 100644 --- a/src/test/ui/issues/issue-40288.nll.stderr +++ b/src/test/ui/issues/issue-40288.nll.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*refr` because it is borrowed LL | save_ref(&*refr, &mut out); | ------ borrow of `*refr` occurs here ... -LL | *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed +LL | *refr = 3; | ^^^^^^^^^ assignment to borrowed `*refr` occurs here ... LL | println!("{:?}", out[0]); diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr index a4847568ba0..fbfbc0cb977 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-1.rs:9:13 | -LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content +LL | let e = f.v[0]; | ^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr index 5c23021ee2c..0c4a85b5901 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-2.rs:5:18 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | - - ^^^^ | | | | | | | cannot move out of borrowed content @@ -12,7 +12,7 @@ LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/issue-40402-2.rs:5:10 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | ^ ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-41726.nll.stderr b/src/test/ui/issues/issue-41726.nll.stderr index 087f557a0d4..c92753d6e3d 100644 --- a/src/test/ui/issues/issue-41726.nll.stderr +++ b/src/test/ui/issues/issue-41726.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/issue-41726.rs:5:9 | -LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable +LL | things[src.as_str()].sort(); | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>` diff --git a/src/test/ui/issues/issue-42106.nll.stderr b/src/test/ui/issues/issue-42106.nll.stderr index 3a31e439c07..d5a9d233bc9 100644 --- a/src/test/ui/issues/issue-42106.nll.stderr +++ b/src/test/ui/issues/issue-42106.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed | LL | let _a = &collection; | ----------- immutable borrow occurs here -LL | collection.swap(1, 2); //~ ERROR also borrowed as immutable +LL | collection.swap(1, 2); | ^^^^^^^^^^ mutable borrow occurs here LL | _a.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/issues/issue-42344.nll.stderr b/src/test/ui/issues/issue-42344.nll.stderr index 9770d26fb12..5cffa1b5121 100644 --- a/src/test/ui/issues/issue-42344.nll.stderr +++ b/src/test/ui/issues/issue-42344.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item --> $DIR/issue-42344.rs:4:5 | -LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] +LL | TAB[0].iter_mut(); | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42796.nll.stderr b/src/test/ui/issues/issue-42796.nll.stderr index 23cc88bab52..d9dfbc999f3 100644 --- a/src/test/ui/issues/issue-42796.nll.stderr +++ b/src/test/ui/issues/issue-42796.nll.stderr @@ -6,7 +6,7 @@ LL | let s = "Hello!".to_owned(); LL | let mut s_copy = s; | - value moved here ... -LL | println!("{}", s); //~ ERROR use of moved value +LL | println!("{}", s); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-44373.nll.stderr b/src/test/ui/issues/issue-44373.nll.stderr index 8359e5af2b8..6f92fbb1eb6 100644 --- a/src/test/ui/issues/issue-44373.nll.stderr +++ b/src/test/ui/issues/issue-44373.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/issue-44373.rs:4:42 | -LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough +LL | let _val: &'static [&'static u32] = &[&FOO]; | ----------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr index 4e2f3f59a64..bfa07059c68 100644 --- a/src/test/ui/issues/issue-49824.nll.stderr +++ b/src/test/ui/issues/issue-49824.nll.stderr @@ -17,7 +17,7 @@ error: compilation successful --> $DIR/issue-49824.rs:8:1 | LL | / fn main() { -LL | | //~^ compilation successful +LL | | LL | | let mut x = 0; LL | | || { ... | diff --git a/src/test/ui/issues/issue-51244.nll.stderr b/src/test/ui/issues/issue-51244.nll.stderr index 7a4935fafc6..c91083955b8 100644 --- a/src/test/ui/issues/issue-51244.nll.stderr +++ b/src/test/ui/issues/issue-51244.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference | LL | let ref my_ref @ _ = 0; | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` -LL | *my_ref = 0; //~ ERROR cannot assign to immutable borrowed content `*my_ref` [E0594] +LL | *my_ref = 0; | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/issues/issue-6801.nll.stderr b/src/test/ui/issues/issue-6801.nll.stderr index 2c0fedf351a..dbb8e6530c0 100644 --- a/src/test/ui/issues/issue-6801.nll.stderr +++ b/src/test/ui/issues/issue-6801.nll.stderr @@ -6,7 +6,7 @@ LL | let sq = || { *x * *x }; | | | borrow of `x` occurs here LL | -LL | twice(x); //~ ERROR: cannot move out of +LL | twice(x); | ^ move out of `x` occurs here LL | invoke(sq); | -- borrow later used here diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr index d70524b2387..0e2fc0a0fe9 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr @@ -5,7 +5,7 @@ LL | let mut x = vec![1].iter(); | ^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | x.use_mut(); | - borrow later used here | diff --git a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr index 521304d5605..ab4460a3268 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | let x: Box<isize> = box 25; | - move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait LL | loop { -LL | take(x); //~ ERROR use of moved value: `x` +LL | take(x); | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr index b7e973bc914..150c1ec82b8 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `y` LL | let y: Box<isize> = box 42; | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait ... -LL | x = y; //~ ERROR use of moved value +LL | x = y; | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-in-while.nll.stderr b/src/test/ui/liveness/liveness-move-in-while.nll.stderr index 167dcc6b643..e1eed1b59f4 100644 --- a/src/test/ui/liveness/liveness-move-in-while.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `y` LL | let y: Box<isize> = box 42; | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait ... -LL | println!("{}", y); //~ ERROR use of moved value: `y` +LL | println!("{}", y); | ^ value borrowed here after move LL | while true { while true { while true { x = y; x.clone(); } } } | - value moved here, in previous iteration of loop diff --git a/src/test/ui/liveness/liveness-use-after-move.nll.stderr b/src/test/ui/liveness/liveness-use-after-move.nll.stderr index 36c25882ccd..383b89afaa7 100644 --- a/src/test/ui/liveness/liveness-use-after-move.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.nll.stderr @@ -5,7 +5,7 @@ LL | let x: Box<_> = box 5; | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | println!("{}", *x); //~ ERROR use of moved value: `*x` +LL | println!("{}", *x); | ^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-use-after-send.nll.stderr b/src/test/ui/liveness/liveness-use-after-send.nll.stderr index d9367c87116..ccf9499f644 100644 --- a/src/test/ui/liveness/liveness-use-after-send.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.nll.stderr @@ -5,7 +5,7 @@ LL | fn test00_start(ch: Chan<Box<isize>>, message: Box<isize>, _count: Box<isiz | ------- move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait LL | send(ch, message); | ------- value moved here -LL | println!("{}", message); //~ ERROR use of moved value: `message` +LL | println!("{}", message); | ^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/loops/loop-proper-liveness.nll.stderr b/src/test/ui/loops/loop-proper-liveness.nll.stderr index 745f0876b40..c87720659fd 100644 --- a/src/test/ui/loops/loop-proper-liveness.nll.stderr +++ b/src/test/ui/loops/loop-proper-liveness.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/loop-proper-liveness.rs:9:22 | -LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable +LL | println!("{:?}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/methods/method-self-arg-2.nll.stderr b/src/test/ui/methods/method-self-arg-2.nll.stderr index 8cfecdba41c..82092dd4c0f 100644 --- a/src/test/ui/methods/method-self-arg-2.nll.stderr +++ b/src/test/ui/methods/method-self-arg-2.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | Foo::bar(&x); //~ERROR cannot borrow `x` +LL | Foo::bar(&x); | ^^ immutable borrow occurs here LL | y.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | Foo::baz(&mut x); //~ERROR cannot borrow `x` +LL | Foo::baz(&mut x); | ^^^^^^ second mutable borrow occurs here LL | y.use_mut(); | - first borrow later used here diff --git a/src/test/ui/moves/move-guard-same-consts.nll.stderr b/src/test/ui/moves/move-guard-same-consts.nll.stderr index 43f99cabcae..0945fbe68a0 100644 --- a/src/test/ui/moves/move-guard-same-consts.nll.stderr +++ b/src/test/ui/moves/move-guard-same-consts.nll.stderr @@ -6,7 +6,7 @@ LL | let x: Box<_> = box 1; ... LL | (1, 2) if take(x) => (), | - value moved here -LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (1, 2) if take(x) => (), | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-in-guard-1.nll.stderr b/src/test/ui/moves/move-in-guard-1.nll.stderr index 41abe6fa72a..542fd169863 100644 --- a/src/test/ui/moves/move-in-guard-1.nll.stderr +++ b/src/test/ui/moves/move-in-guard-1.nll.stderr @@ -6,7 +6,7 @@ LL | let x: Box<_> = box 1; ... LL | (1, _) if take(x) => (), | - value moved here -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-in-guard-2.nll.stderr b/src/test/ui/moves/move-in-guard-2.nll.stderr index 0b14c1620d3..8bd405279c5 100644 --- a/src/test/ui/moves/move-in-guard-2.nll.stderr +++ b/src/test/ui/moves/move-in-guard-2.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | let x: Box<_> = box 1; | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait ... -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-1.nll.stderr b/src/test/ui/moves/move-into-dead-array-1.nll.stderr index e3a2a601246..33da0e54a1e 100644 --- a/src/test/ui/moves/move-into-dead-array-1.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `a` --> $DIR/move-into-dead-array-1.rs:14:5 | -LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` +LL | a[i] = d(); | ^^^^ use of possibly uninitialized `a` error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-2.nll.stderr b/src/test/ui/moves/move-into-dead-array-2.nll.stderr index 20bfdc2bbac..19e476c04ea 100644 --- a/src/test/ui/moves/move-into-dead-array-2.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-2.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(mut a: [D; 4], i: usize) { | ----- move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait LL | drop(a); | - value moved here -LL | a[i] = d(); //~ ERROR use of moved value: `a` +LL | a[i] = d(); | ^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-slice-1.nll.stderr b/src/test/ui/moves/move-out-of-slice-1.nll.stderr index c8c09b31d36..b4b1fe97ca9 100644 --- a/src/test/ui/moves/move-out-of-slice-1.nll.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.nll.stderr @@ -3,13 +3,13 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice | LL | match a { | ^ cannot move out of here -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | - data moved here | note: move occurs because `a` has type `A`, which does not implement the `Copy` trait --> $DIR/move-out-of-slice-1.rs:8:14 | -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | ^ error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr index 2efdc84ca37..888ef3352e2 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr +++ b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | --- value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^^^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | --- value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^^^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr index 6ad9a2d414c..71a3c4506ea 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr @@ -5,7 +5,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait LL | consume(x.into_iter().next().unwrap()); | - value moved here -LL | touch(&x[0]); //~ ERROR use of moved value: `x` +LL | touch(&x[0]); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr index 6950a56a533..b83a15c9d4d 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/moves-based-on-type-block-bad.rs:24:19 | -LL | match hellothere.x { //~ ERROR cannot move out +LL | match hellothere.x { | ^^^^^^^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr index bed0ae7275c..3a05a1305be 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr @@ -8,7 +8,7 @@ LL | thread::spawn(move|| { LL | println!("{}", x); | - variable moved due to use in closure LL | }); -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr index 5f0d2b42671..fb8562d00ea 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `node` LL | Some(right) => consume(right), | ----- value moved here ... -LL | consume(node) + r //~ ERROR use of partially moved value: `node` +LL | consume(node) + r | ^^^^ value used here after partial move | = note: move occurs because value has type `std::boxed::Box<List>`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr index 07f40274f9e..25f88fe157a 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr @@ -5,8 +5,8 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -16,8 +16,8 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:(((x))) }; | ------- value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^^ value borrowed here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr index 162aec45f5f..67fae606c4e 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr @@ -5,7 +5,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -15,7 +15,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = (x, 3); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -27,7 +27,7 @@ LL | let x = "hi".to_string(); LL | x | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `y` @@ -39,7 +39,7 @@ LL | let y = "ho".to_string(); LL | y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -51,7 +51,7 @@ LL | let x = "hi".to_string(); LL | true => x, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `y` @@ -63,7 +63,7 @@ LL | let y = "ho".to_string(); LL | false => y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -75,7 +75,7 @@ LL | let x = "hi".to_string(); LL | _ if guard(x) => 10, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -85,7 +85,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = [x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -95,7 +95,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = vec![x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -105,7 +105,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait LL | let _y = x.into_iter().next().unwrap(); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -115,7 +115,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait LL | let _y = [x.into_iter().next().unwrap(); 1]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error: aborting due to 11 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr index 6d523fc09c0..322999a1f0f 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x` LL | Foo {f} => {} | - value moved here ... -LL | touch(&x); //~ ERROR use of partially moved value: `x` +LL | touch(&x); | ^^ value borrowed here after partial move | = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr index 7d410f6cabc..0568a2e94a7 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let i = box 3; | - captured outer variable -LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out +LL | let _f = to_fn(|| test(i)); | ^ cannot move out of captured variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr index 391dd67dbf6..dde54eee83b 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr @@ -16,7 +16,7 @@ LL | fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) { | consider adding a `Copy` constraint to this type argument LL | let mut r = R {c: Box::new(f)}; | - value moved here -LL | f(&mut r, false) //~ ERROR use of moved value +LL | f(&mut r, false) | ^ value borrowed here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-sru-moved-field.nll.stderr b/src/test/ui/moves/moves-sru-moved-field.nll.stderr index e5daab36f6e..a012c2d9b7b 100644 --- a/src/test/ui/moves/moves-sru-moved-field.nll.stderr +++ b/src/test/ui/moves/moves-sru-moved-field.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `f.moved` | LL | let _b = Foo {noncopyable: g, ..f}; | ------------------------- value moved here -LL | let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved` +LL | let _c = Foo {noncopyable: h, ..f}; | ^^^^^^^^^^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `f.moved` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait diff --git a/src/test/ui/mut/mut-cant-alias.nll.stderr b/src/test/ui/mut/mut-cant-alias.nll.stderr index 2d7104b39c4..d56e45db13d 100644 --- a/src/test/ui/mut/mut-cant-alias.nll.stderr +++ b/src/test/ui/mut/mut-cant-alias.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `b` as mutable more than once at a time | LL | let b1 = &mut *b; | - first mutable borrow occurs here -LL | let b2 = &mut *b; //~ ERROR cannot borrow +LL | let b2 = &mut *b; | ^ second mutable borrow occurs here LL | b1.use_mut(); | -- first borrow later used here diff --git a/src/test/ui/mut/mutable-class-fields-2.nll.stderr b/src/test/ui/mut/mutable-class-fields-2.nll.stderr index 53127922263..15323ce9a97 100644 --- a/src/test/ui/mut/mutable-class-fields-2.nll.stderr +++ b/src/test/ui/mut/mutable-class-fields-2.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `self.how_hungry` which is behind a `&` reference | LL | pub fn eat(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | self.how_hungry -= 5; //~ ERROR cannot assign +LL | self.how_hungry -= 5; | ^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr index 30b4bf75af6..5d50ed67e2f 100644 --- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:5:15 | -LL | let x = { *r }; //~ ERROR +LL | let x = { *r }; | ^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = { *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:6:22 | -LL | let y = unsafe { *r }; //~ ERROR +LL | let y = unsafe { *r }; | ^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let y = unsafe { *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:7:26 | -LL | let z = loop { break *r; }; //~ ERROR +LL | let z = loop { break *r; }; | ^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let z = loop { break *r; }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:11:15 | -LL | let x = { arr[0] }; //~ ERROR +LL | let x = { arr[0] }; | ^^^^^^ | | | cannot move out of here @@ -37,7 +37,7 @@ LL | let x = { arr[0] }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:12:22 | -LL | let y = unsafe { arr[0] }; //~ ERROR +LL | let y = unsafe { arr[0] }; | ^^^^^^ | | | cannot move out of here @@ -46,7 +46,7 @@ LL | let y = unsafe { arr[0] }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:13:26 | -LL | let z = loop { break arr[0]; }; //~ ERROR +LL | let z = loop { break arr[0]; }; | ^^^^^^ | | | cannot move out of here @@ -55,7 +55,7 @@ LL | let z = loop { break arr[0]; }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:38 | -LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let x = { let mut u = 0; u += 1; *r }; | ^^ | | | cannot move out of borrowed content @@ -64,7 +64,7 @@ LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:18:45 | -LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let y = unsafe { let mut u = 0; u += 1; *r }; | ^^ | | | cannot move out of borrowed content @@ -73,7 +73,7 @@ LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:19:49 | -LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR +LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/nll/issue-54556-niconii.nll.stderr b/src/test/ui/nll/issue-54556-niconii.nll.stderr index 58239fe6e88..40cd04de5ec 100644 --- a/src/test/ui/nll/issue-54556-niconii.nll.stderr +++ b/src/test/ui/nll/issue-54556-niconii.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough +LL | if let Ok(_) = counter.lock() { } | ^^^^^^^------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr index b58454427af..0bf76485eef 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:21 | -LL | let rows = Rows(&stmt); //~ ERROR does not live long enough +LL | let rows = Rows(&stmt); | ^^^^^ borrowed value does not live long enough LL | rows.map(|row| row).next() | ------------------- a temporary with access to the borrow is created here ... diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr index 1bc43017bc6..513dca7950a 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 | -LL | D(&_thing1).end() //~ ERROR does not live long enough +LL | D(&_thing1).end() | --^^^^^^^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr b/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr index a13e59fa48b..9f27fac15a7 100644 --- a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr +++ b/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/src/test/ui/nll/issue-55850.nll.stderr b/src/test/ui/nll/issue-55850.nll.stderr index e09711f74fd..bf0c6986ef2 100644 --- a/src/test/ui/nll/issue-55850.nll.stderr +++ b/src/test/ui/nll/issue-55850.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `s` does not live long enough --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | ^ borrowed value does not live long enough LL | }) | - `s` dropped here while still borrowed @@ -9,7 +9,7 @@ LL | }) error[E0626]: borrow may still be in use when generator yields --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | -------^---- possible yield occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/no-reuse-move-arc.nll.stderr b/src/test/ui/no-reuse-move-arc.nll.stderr index 0b14f65a770..3f7169e6fcb 100644 --- a/src/test/ui/no-reuse-move-arc.nll.stderr +++ b/src/test/ui/no-reuse-move-arc.nll.stderr @@ -9,7 +9,7 @@ LL | thread::spawn(move|| { LL | assert_eq!((*arc_v)[3], 4); | ----- variable moved due to use in closure ... -LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v` +LL | assert_eq!((*arc_v)[2], 3); | ^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/not-copy-closure.nll.stderr b/src/test/ui/not-copy-closure.nll.stderr index 1a65bcf4473..10bf570727f 100644 --- a/src/test/ui/not-copy-closure.nll.stderr +++ b/src/test/ui/not-copy-closure.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `hello` | LL | let b = hello; | ----- value moved here -LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382] +LL | let c = hello; | ^^^^^ value used here after move | note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr index 0dd50b28026..1497aa42082 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined --> $DIR/object-safety-by-value-self-use.rs:15:5 | -LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static) +LL | t.bar() | ^ error: aborting due to previous error diff --git a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr index ea53abc1b0f..f98d3d83845 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr @@ -7,7 +7,7 @@ LL | fn foo<F:FnOnce()>(blk: F) { | consider adding a `Copy` constraint to this type argument LL | blk(); | --- value moved here -LL | blk(); //~ ERROR use of moved value +LL | blk(); | ^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/ref-suggestion.nll.stderr b/src/test/ui/ref-suggestion.nll.stderr index 402f3c77cdb..9ff8e21bb58 100644 --- a/src/test/ui/ref-suggestion.nll.stderr +++ b/src/test/ui/ref-suggestion.nll.stderr @@ -5,7 +5,7 @@ LL | let x = vec![1]; | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move error[E0382]: use of moved value: `x` @@ -15,7 +15,7 @@ LL | let x = vec![1]; | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait LL | let mut y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move error[E0382]: use of moved value: `x` @@ -24,7 +24,7 @@ error[E0382]: use of moved value: `x` LL | (Some(y), ()) => {}, | - value moved here ... -LL | x; //~ ERROR use of partially moved value +LL | x; | ^ value used here after partial move | = note: move occurs because value has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr index fa4c8a9dc6d..bce310bafaa 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr @@ -3,8 +3,8 @@ warning: function cannot return without recursing | LL | fn call_rec<F>(mut f: F) -> usize where F: FnMut(usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | +LL | (|x| f(x))(call_rec(f)) | ----------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -13,7 +13,7 @@ LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` error[E0505]: cannot move out of `f` because it is borrowed --> $DIR/region-bound-on-closure-outlives-call.rs:3:25 | -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | (|x| f(x))(call_rec(f)) | ---------- ^ move out of `f` occurs here | || | | || borrow occurs due to use in closure diff --git a/src/test/ui/regions/region-object-lifetime-5.nll.stderr b/src/test/ui/regions/region-object-lifetime-5.nll.stderr index c6d7135a2db..b86f6e3a2a1 100644 --- a/src/test/ui/regions/region-object-lifetime-5.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-5.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*x` --> $DIR/region-object-lifetime-5.rs:11:5 | -LL | x.borrowed() //~ ERROR `*x` does not live long enough +LL | x.borrowed() | -^^^^^^^^^^^ | | | returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-addr-of-arg.nll.stderr b/src/test/ui/regions/regions-addr-of-arg.nll.stderr index 0f60bc669b2..54f44b98b91 100644 --- a/src/test/ui/regions/regions-addr-of-arg.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-arg.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:5:30 | -LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough +LL | let _p: &'static isize = &a; | -------------- ^^ borrowed value does not live long enough | | | type annotation requires that `a` is borrowed for `'static` @@ -11,7 +11,7 @@ LL | } error[E0515]: cannot return reference to function parameter `a` --> $DIR/regions-addr-of-arg.rs:13:5 | -LL | &a //~ ERROR `a` does not live long enough +LL | &a | ^^ returns a reference to data owned by the current function error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr index f188da5038d..2c55634445d 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:14:16 | -LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | v[0].oh_no(&v); | - ----- ^^ immutable borrow occurs here | | | | | mutable borrow later used by call @@ -10,7 +10,7 @@ LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:15:16 | -LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | (*v).oh_no(&v); | - ----- ^^ immutable borrow occurs here | | | | | mutable borrow later used by call diff --git a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr index 0e68a0548e6..8e119c4f535 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-1.rs:12:5 | -LL | box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box<X> | ^^^^^^---^^^^^^^^^^^ | | | | | `*v` is borrowed here diff --git a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr index 6225575ddf3..9ea13638f5c 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-3.rs:11:5 | -LL | box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box<X> | ^^^^^^---^^^^^^^^^^^ | | | | | `*v` is borrowed here diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr index fe4b97a33b5..a95d8462901 100644 --- a/src/test/ui/regions/regions-creating-enums.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:23:16 | -LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); | ^----------------- | || | |temporary value created here @@ -10,7 +10,7 @@ LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live l error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:28:16 | -LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); | ^------------------ | || | |temporary value created here diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr index 62f0ceba94f..2c7a6e8b5c0 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*p` --> $DIR/regions-infer-borrow-scope-too-big.rs:13:12 | -LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough +LL | let xc = x_coord(&*p); | --- `*p` is borrowed here LL | assert_eq!(*xc, 3); LL | return xc; diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr index b44f8c1e7a8..803d0d74491 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/regions-infer-proc-static-upvar.rs:10:13 | -LL | let y = &x; //~ ERROR `x` does not live long enough +LL | let y = &x; | ^^ borrowed value does not live long enough LL | / foo(move|| { LL | | let _a = *y; diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr index 48daff1dbd8..7984f4f0e54 100644 --- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let testValue = &id(Test); | -------- temporary value created here -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | testValue | ^^^^^^^^^ returns a value referencing data owned by the current function @@ -12,7 +12,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let testValue = &id(MyEnum::Variant1); | -------------------- temporary value created here -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | testValue | ^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-nested-fns-2.nll.stderr b/src/test/ui/regions/regions-nested-fns-2.nll.stderr index ebcc31d3a20..8627dac5459 100644 --- a/src/test/ui/regions/regions-nested-fns-2.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns-2.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | |z| { | --- value captured here -LL | //~^ ERROR E0373 +LL | LL | if false { &y } else { z } | -^ | || diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr index 8809cf4b09e..f77d94a24b8 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `line` does not live long enough --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | -LL | match [&*line] { //~ ERROR `line` does not live long enough +LL | match [&*line] { | ^^^^ borrowed value does not live long enough LL | [ word ] => { assert_static(word); } | ------------------- argument requires that `line` is borrowed for `'static` diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr index bead12356f1..ccba6c59b61 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr @@ -3,13 +3,13 @@ error[E0515]: cannot return value referencing function parameter | LL | fn arg_item(box ref x: Box<isize>) -> &'static isize { | --------- function parameter borrowed here -LL | x //~^ ERROR borrowed value does not live long enough +LL | x | ^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing function parameter --> $DIR/regions-ref-in-fn-arg.rs:11:22 | -LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough +LL | with(|box ref x| x) | --------- ^ returns a value referencing data owned by the current function | | | function parameter borrowed here diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr index b8b4ce56bb2..0e4875ac985 100644 --- a/src/test/ui/regions/regions-ret.nll.stderr +++ b/src/test/ui/regions/regions-ret.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-ret.rs:4:12 | -LL | return &id(3); //~ ERROR borrowed value does not live long enough +LL | return &id(3); | ^----- | || | |temporary value created here diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr index 1bdcf83521d..9d87fe266b1 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-return-stack-allocated-vec.rs:4:5 | -LL | &[x] //~ ERROR borrowed value does not live long enough +LL | &[x] | ^--- | || | |temporary value created here diff --git a/src/test/ui/regions/regions-steal-closure.nll.stderr b/src/test/ui/regions/regions-steal-closure.nll.stderr index c30f9c52363..5b0efaf9559 100644 --- a/src/test/ui/regions/regions-steal-closure.nll.stderr +++ b/src/test/ui/regions/regions-steal-closure.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `i` does not live long enough LL | let mut cl_box = { | ---------- borrow later stored here LL | let mut i = 3; -LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough +LL | box_it(Box::new(|| i += 1)) | -- ^ borrowed value does not live long enough | | | value captured here diff --git a/src/test/ui/regions/regions-trait-variance.nll.stderr b/src/test/ui/regions/regions-trait-variance.nll.stderr index ca05c93a7ec..56c9f89e1f5 100644 --- a/src/test/ui/regions/regions-trait-variance.nll.stderr +++ b/src/test/ui/regions/regions-trait-variance.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*b` --> $DIR/regions-trait-variance.rs:38:5 | -LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough +LL | let bb: &B = &*b; | --- `*b` is borrowed here LL | make_a(bb) | ^^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr index e38574e774d..146fb8fd81f 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/regions-var-type-out-of-scope.rs:9:14 | -LL | x = &id(3); //~ ERROR borrowed value does not live long enough +LL | x = &id(3); | ^^^^^- temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr index 3a6f66ca4da..04572920ee4 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr @@ -5,7 +5,7 @@ LL | while let Some(Ok(string)) = foo.get() { | --- immutable borrow occurs here LL | foo.mutate(); | ^^^^^^^^^^^^ mutable borrow occurs here -LL | //~^ ERROR cannot borrow `foo` as mutable +LL | LL | println!("foo={:?}", *string); | ------- immutable borrow later used here diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr index 5920be4132a..d6a89006bc0 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:9:5 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:13:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:19:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr index 2206c2f340e..a6f2f3ec309 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:7:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:15:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:23:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr index 5a730ad2be4..5f0b3a1d40b 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr @@ -5,7 +5,7 @@ LL | let a = NoCopy(0); | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); //~ ERROR use of moved value +LL | let _ = dbg!(a); | ^ value used here after move | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/slice-mut-2.nll.stderr b/src/test/ui/slice-mut-2.nll.stderr index eeef23e694b..bad0268772b 100644 --- a/src/test/ui/slice-mut-2.nll.stderr +++ b/src/test/ui/slice-mut-2.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | let x: &[isize] = &[1, 2, 3, 4, 5]; | ---------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4, 5]` ... -LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable +LL | let _ = &mut x[2..4]; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr index 0aa44fa3a3a..0a9bc3ac51c 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut_field1(x: Own<Point>) { | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>` -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -19,7 +19,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _x = &mut x.x; | - first mutable borrow occurs here -LL | let _y = &mut x.y; //~ ERROR cannot borrow +LL | let _y = &mut x.y; | ^ second mutable borrow occurs here LL | use_mut(_x); | -- first borrow later used here @@ -29,7 +29,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign_field1<'a>(x: Own<Point>) { | - help: consider changing this to be mutable: `mut x` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -37,7 +37,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign_field2<'a>(x: &'a Own<Point>) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<Point>` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -45,7 +45,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _p: &mut Point = &mut **x; | -- first mutable borrow occurs here -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ second mutable borrow occurs here LL | use_mut(_p); | -- first borrow later used here @@ -55,7 +55,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut_method1(x: Own<Point>) { | - help: consider changing this to be mutable: `mut x` -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -63,7 +63,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut_method1(x: &Own<Point>) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>` -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -71,7 +71,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign_method1<'a>(x: Own<Point>) { | - help: consider changing this to be mutable: `mut x` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -79,7 +79,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign_method2<'a>(x: &'a Own<Point>) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<Point>` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 10 previous errors diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr index ef80e4bc3d6..3ebfba7e4de 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut1(x: Own<isize>) { | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut1<'a>(x: &'a Own<isize>) -> &'a mut isize { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>` -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign1<'a>(x: Own<isize>) { | - help: consider changing this to be mutable: `mut x` -LL | *x = 3; //~ ERROR cannot borrow +LL | *x = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -27,7 +27,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign2<'a>(x: &'a Own<isize>) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>` -LL | **x = 3; //~ ERROR cannot borrow +LL | **x = 3; | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 4 previous errors diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr index e752a467edc..80dc3ef2f80 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr @@ -6,7 +6,7 @@ LL | f(Box::new(|| { | | | first mutable borrow occurs here | first borrow later used by call -LL | //~^ ERROR: cannot borrow `f` as mutable more than once +LL | LL | f((Box::new(|| {}))) | - second borrow occurs due to use of `f` in closure diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr index 16c482b575a..6b5e0779e5f 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn b(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` LL | x.f(); -LL | x.h(); //~ ERROR cannot borrow +LL | x.h(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-object-mutability.nll.stderr b/src/test/ui/span/borrowck-object-mutability.nll.stderr index 1a5802e9811..fe6014cd5ad 100644 --- a/src/test/ui/span/borrowck-object-mutability.nll.stderr +++ b/src/test/ui/span/borrowck-object-mutability.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn borrowed_receiver(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable LL | fn owned_receiver(x: Box<Foo>) { | - help: consider changing this to be mutable: `mut x` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/span/destructor-restrictions.nll.stderr b/src/test/ui/span/destructor-restrictions.nll.stderr index 981c5a23816..a3c6cfb6ae4 100644 --- a/src/test/ui/span/destructor-restrictions.nll.stderr +++ b/src/test/ui/span/destructor-restrictions.nll.stderr @@ -6,7 +6,7 @@ LL | *a.borrow() + 1 | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... -LL | }; //~^ ERROR `*a` does not live long enough +LL | }; | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, i32>` | | | `*a` dropped here while still borrowed diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr index 5774ac13cb7..07ae138ac71 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr @@ -17,7 +17,7 @@ error[E0597]: `d1` does not live long enough | LL | d2.p.set(Some(&d1)); | ^^^ borrowed value does not live long enough -LL | //~^ ERROR `d1` does not live long enough +LL | LL | } | - | | diff --git a/src/test/ui/span/issue-11925.nll.stderr b/src/test/ui/span/issue-11925.nll.stderr index f5e329f6c39..1d317fc331f 100644 --- a/src/test/ui/span/issue-11925.nll.stderr +++ b/src/test/ui/span/issue-11925.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to local data `x` --> $DIR/issue-11925.rs:8:35 | -LL | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough +LL | let f = to_fn_once(move|| &x); | ^^ returns a reference to data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/span/mut-arg-hint.nll.stderr b/src/test/ui/span/mut-arg-hint.nll.stderr index e0fa3c3a1e6..8027cf69cf4 100644 --- a/src/test/ui/span/mut-arg-hint.nll.stderr +++ b/src/test/ui/span/mut-arg-hint.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("bar"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | pub fn foo<'a>(mut a: &'a String) { | ---------- help: consider changing this to be a mutable reference: `&'a mut String` -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | pub fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr index d3ba848fe6b..21b29464df5 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr @@ -5,7 +5,7 @@ LL | p = &*b; | ^ borrowed value does not live long enough LL | } | - `b` dropped here while still borrowed -LL | //~^^ ERROR `b` does not live long enough +LL | LL | p.use_ref(); | - borrow later used here diff --git a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr index e07fb727782..284981e9341 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr @@ -3,9 +3,9 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { | ^ use of borrowed `x` -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let mut z = x; LL | _y.push(&mut z); | -- borrow later used here @@ -14,8 +14,8 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { +LL | let mut z = x; | ^ use of borrowed `x` LL | _y.push(&mut z); | -- borrow later used here @@ -39,8 +39,8 @@ LL | let mut _y = vec![&mut x]; ... LL | _y.push(&mut z); | -- borrow later used here -LL | //~^ ERROR `z` does not live long enough -LL | x += 1; //~ ERROR cannot assign +LL | +LL | x += 1; | ^^^^^^ use of borrowed `x` error: aborting due to 4 previous errors diff --git a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr index 54960c16405..93473a86b5a 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.lock().unwrap() = &*y; | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.lock().unwrap() = &z; @@ -16,7 +16,7 @@ LL | *lock.lock().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } | - `z` dropped here while still borrowed -LL | //~^^ ERROR `z` does not live long enough +LL | LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use) | ---- borrow later used here @@ -25,7 +25,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.write().unwrap() = &*y; | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.write().unwrap() = &z; @@ -38,7 +38,7 @@ LL | *lock.write().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } | - `z` dropped here while still borrowed -LL | //~^^ ERROR `z` does not live long enough +LL | LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use) | ---- borrow later used here @@ -47,7 +47,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | tx.send(&*y); | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | tx.send(&z).unwrap(); diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr index c5e2ca2e28f..f87c32d1ad0 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr @@ -17,7 +17,7 @@ error[E0597]: `c1` does not live long enough | LL | c2.v[0].v.set(Some(&c1)); | ^^^ borrowed value does not live long enough -LL | //~^ ERROR `c1` does not live long enough +LL | LL | } | - | | diff --git a/src/test/ui/static/static-lifetime-bound.nll.stderr b/src/test/ui/static/static-lifetime-bound.nll.stderr index 9a8a344cbd8..90d728204e7 100644 --- a/src/test/ui/static/static-lifetime-bound.nll.stderr +++ b/src/test/ui/static/static-lifetime-bound.nll.stderr @@ -1,7 +1,7 @@ warning: unnecessary lifetime parameter `'a` --> $DIR/static-lifetime-bound.rs:1:6 | -LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +LL | fn f<'a: 'static>(_: &'a i32) {} | ^^^^^^^^^^^ | = help: you can use the `'static` lifetime directly, in place of `'a` @@ -9,7 +9,7 @@ LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:7 | -LL | f(&x); //~ERROR does not live long enough +LL | f(&x); | --^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr index 2e00c9491d7..07c8b48eb1d 100644 --- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.nll.stderr @@ -37,7 +37,7 @@ error[E0515]: cannot return value referencing temporary value LL | / StateMachineIter { LL | | statefn: &id(state1 as StateMachineFunc) | | ------------------------------ temporary value created here -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | } | |_____^ returns a value referencing data owned by the current function diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr index 0a5686051cd..15261259ed4 100644 --- a/src/test/ui/static/static-region-bound.nll.stderr +++ b/src/test/ui/static/static-region-bound.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/static-region-bound.rs:10:14 | -LL | let x = &id(3); //~ ERROR borrowed value does not live long enough +LL | let x = &id(3); | ^^^^^ creates a temporary which is freed while still in use LL | f(x); | ---- argument requires that borrow lasts for `'static` diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr index 0a5e7c64b1a..8241f6f1fdb 100644 --- a/src/test/ui/std-uncopyable-atomics.nll.stderr +++ b/src/test/ui/std-uncopyable-atomics.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:9:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:11:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:13:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:15:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/thread-local-mutation.nll.stderr b/src/test/ui/thread-local-mutation.nll.stderr index 0a3664b0d9d..e5dc0e72edf 100644 --- a/src/test/ui/thread-local-mutation.nll.stderr +++ b/src/test/ui/thread-local-mutation.nll.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to immutable static item `S` --> $DIR/thread-local-mutation.rs:11:5 | -LL | S = "after"; //~ ERROR cannot assign to immutable +LL | S = "after"; | ^^^^^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr index 6092a9dc10d..4ee3e4cacc3 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `person` does not live long enough --> $DIR/trait-coercion-generic-regions.rs:17:24 | -LL | let person: &str = &person; //~ ERROR `person` does not live long enough +LL | let person: &str = &person; | ^^^^^^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr index 8b86dd9a4c9..aac119afda5 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference | LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` -LL | *t //~ ERROR +LL | *t | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference | LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` -LL | {*t} //~ ERROR +LL | {*t} | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr index 0e996902d62..934d057ea09 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn(|| drop(x)); | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure @@ -11,7 +11,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(|| drop(x)); | ^ cannot move out of captured variable in an `FnMut` closure error[E0507]: cannot move out of captured variable in an `Fn` closure @@ -19,7 +19,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn(move || drop(x)); | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure @@ -27,7 +27,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(move || drop(x)); | ^ cannot move out of captured variable in an `FnMut` closure error: aborting due to 4 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr index 51a0a6e5756..3e7f79040fe 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -11,8 +11,8 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || x = 1; +LL | move || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -21,7 +21,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -30,7 +30,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -39,7 +39,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -48,7 +48,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -57,7 +57,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -66,7 +66,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^^^^^ cannot borrow as mutable error: aborting due to 8 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr index 1c55a6bb08e..b40b2f67d9b 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `x` does not live long enough LL | let _f = { | -- borrow later stored here LL | let x = 0; -LL | || x //~ ERROR `x` does not live long enough +LL | || x | -- ^ borrowed value does not live long enough | | | value captured here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr index a47d33d29e1..21d6b4fde7e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr @@ -5,7 +5,7 @@ LL | let f = || x += 1; | -- - borrow occurs due to use of `x` in closure | | | borrow of `x` occurs here -LL | let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let _y = x; | ^ use of borrowed `x` LL | f; | - borrow later used here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr index 1749c20b582..19cb2cb7338 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr @@ -34,7 +34,7 @@ LL | let mut factorial: Option<Box<Fn(u32) -> u32 + 'static>> = None; LL | LL | let f = |x: u32| -> u32 { | --------------- value captured here -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | ^^^^^^^^^ borrowed value does not live long enough ... @@ -49,7 +49,7 @@ LL | let mut factorial: Option<Box<Fn(u32) -> u32 + 'static>> = None; LL | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | --------- borrow occurs due to use in closure ... diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr index 89ac402b5e0..1e1172cdbf2 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr @@ -10,10 +10,10 @@ LL | tick1(); error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5 | -LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` +LL | let tick2 = || { | ----- help: consider changing this to be mutable: `mut tick2` ... -LL | tick2(); //~ ERROR cannot borrow +LL | tick2(); | ^^^^^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr index 9c0a71e73f5..eb398628846 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable | LL | let tick = || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr index fa3426a1f70..b9d76d9a752 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable | LL | let tick = move || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr index 9b2f1cd4ae3..6bba38510b6 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable | LL | let n = 0; | - help: consider changing this to be mutable: `mut n` -LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign +LL | let mut f = to_fn_mut(|| { LL | n += 1; | ^^^^^^ cannot assign @@ -13,7 +13,7 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable LL | let n = 0; | - help: consider changing this to be mutable: `mut n` ... -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is not declared as mutable @@ -22,13 +22,13 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable LL | let n = 0; | - help: consider changing this to be mutable: `mut n` LL | let mut f = to_fn(move || { -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -36,7 +36,7 @@ help: consider changing this to accept closures that implement `FnMut` | LL | let mut f = to_fn(move || { | _______________________^ -LL | | n += 1; //~ ERROR cannot assign +LL | | n += 1; LL | | }); | |_____^ diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr index 29d161fe150..70860c822eb 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borr | LL | let a = &mut u.x.0; | ---------- mutable borrow occurs here (via `u.x.0`) -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -17,7 +17,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.x.0; | ----- value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^^^ value used here after move error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`) @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borr | LL | let a = &mut (u.x.0).0; | -------------- mutable borrow occurs here (via `u.x.0.0`) -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -39,7 +39,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = (u.x.0).0; | --------- value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^^^ value used here after move error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `*u.y`) @@ -47,7 +47,7 @@ error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borr | LL | let a = &mut *u.y; | --------- mutable borrow occurs here (via `*u.y`) -LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) +LL | let b = &u.x; | ^^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -61,7 +61,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = *u.y; | ---- value moved here -LL | let b = u.x; //~ ERROR use of moved value: `u.x` +LL | let b = u.x; | ^^^ value used here after move error: aborting due to 6 previous errors diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr index 58953d55b1f..c11445c8adf 100644 --- a/src/test/ui/unop-move-semantics.nll.stderr +++ b/src/test/ui/unop-move-semantics.nll.stderr @@ -8,7 +8,7 @@ LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) { LL | !x; | - value moved here LL | -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value borrowed here after move error[E0505]: cannot move out of `x` because it is borrowed @@ -17,7 +17,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | -- borrow of `x` occurs here ... -LL | !x; //~ ERROR: cannot move out of `x` because it is borrowed +LL | !x; | ^ move out of `x` occurs here ... LL | use_mut(n); use_imm(m); @@ -29,7 +29,7 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | ------ borrow of `y` occurs here ... -LL | !y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | !y; | ^ move out of `y` occurs here LL | use_mut(n); use_imm(m); | - borrow later used here @@ -37,13 +37,13 @@ LL | use_mut(n); use_imm(m); error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:24:6 | -LL | !*m; //~ ERROR: cannot move out of borrowed content +LL | !*m; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:26:6 | -LL | !*n; //~ ERROR: cannot move out of borrowed content +LL | !*n; | ^^ cannot move out of borrowed content error: aborting due to 5 previous errors diff --git a/src/test/ui/unsized-locals/double-move.nll.stderr b/src/test/ui/unsized-locals/double-move.nll.stderr index c0c3e436f53..47fa0d4a437 100644 --- a/src/test/ui/unsized-locals/double-move.nll.stderr +++ b/src/test/ui/unsized-locals/double-move.nll.stderr @@ -5,7 +5,7 @@ LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | drop_unsized(y); | - value moved here -LL | drop_unsized(y); //~ERROR use of moved value +LL | drop_unsized(y); | ^ value used here after move error[E0382]: use of moved value: `x` @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = *x; | -- value moved here -LL | drop_unsized(x); //~ERROR use of moved value +LL | drop_unsized(x); | ^ value used here after partial move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -25,7 +25,7 @@ LL | let x = "hello".to_owned().into_boxed_str(); | - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait LL | drop_unsized(x); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move error[E0382]: use of moved value: `y` @@ -35,7 +35,7 @@ LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | y.foo(); | - value moved here -LL | y.foo(); //~ERROR use of moved value +LL | y.foo(); | ^ value used here after move error[E0382]: use of moved value: `*x` @@ -43,7 +43,7 @@ error[E0382]: use of moved value: `*x` | LL | let _y = *x; | -- value moved here -LL | x.foo(); //~ERROR use of moved value +LL | x.foo(); | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -53,7 +53,7 @@ error[E0382]: use of moved value: `*x` | LL | x.foo(); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-after-move-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-based-on-type.nll.stderr index 8160ada9d62..520f88f55dc 100644 --- a/src/test/ui/use/use-after-move-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.nll.stderr @@ -5,7 +5,7 @@ LL | let x = "Hello!".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = x; | - value moved here -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr index 4119741d805..9bf1175430c 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr @@ -5,7 +5,7 @@ LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here -LL | return self.x; //~ ERROR use of moved value: `self.x` +LL | return self.x; | ^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self.nll.stderr b/src/test/ui/use/use-after-move-self.nll.stderr index e2ce3690cb9..3be0a65550b 100644 --- a/src/test/ui/use/use-after-move-self.nll.stderr +++ b/src/test/ui/use/use-after-move-self.nll.stderr @@ -5,7 +5,7 @@ LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here -LL | return *self.x; //~ ERROR use of moved value: `*self.x` +LL | return *self.x; | ^^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/variance/variance-issue-20533.nll.stderr b/src/test/ui/variance/variance-issue-20533.nll.stderr index 469adaf6f0e..008e2a002bb 100644 --- a/src/test/ui/variance/variance-issue-20533.nll.stderr +++ b/src/test/ui/variance/variance-issue-20533.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = foo(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here @@ -13,7 +13,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = bar(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here @@ -23,7 +23,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = baz(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here diff --git a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr index c77be26f019..679fd899773 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr +++ b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr @@ -6,7 +6,7 @@ LL | for x in &mut xs { | | | first mutable borrow occurs here | first borrow later used here -LL | xs.push(1) //~ ERROR cannot borrow `xs` +LL | xs.push(1) | ^^ second mutable borrow occurs here error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.nll.stderr b/src/test/ui/walk-struct-literal-with.nll.stderr index 2263747607b..eeb594a21f3 100644 --- a/src/test/ui/walk-struct-literal-with.nll.stderr +++ b/src/test/ui/walk-struct-literal-with.nll.stderr @@ -5,7 +5,7 @@ LL | let start = Mine{test:"Foo".to_string(), other_val:0}; | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait LL | let end = Mine{other_val:1, ..start.make_string_bar()}; | ----- value moved here -LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test` +LL | println!("{}", start.test); | ^^^^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr index 21ac2031d04..fc58984345a 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:22:5 | -LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough +LL | s.transmute_inherent(&mut 42) | ^^^^^^^^^^^^^^^^^^^^^^^^^^--^ | | | | | temporary value created here @@ -10,7 +10,7 @@ LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough error[E0515]: cannot return value referencing local variable `four` --> $DIR/wf-misc-methods-issue-28609.rs:36:5 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ----- `four` is borrowed here LL | &s | ^^ returns a value referencing data owned by the current function @@ -18,7 +18,7 @@ LL | &s error[E0515]: cannot return value referencing local variable `four` --> $DIR/wf-misc-methods-issue-28609.rs:43:5 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ----- `four` is borrowed here LL | &*s | ^^^ returns a value referencing data owned by the current function @@ -26,7 +26,7 @@ LL | &*s error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:53:5 | -LL | s << &mut 3 //~ ERROR does not live long enough +LL | s << &mut 3 | ^^^^^^^^^^- | | | | | temporary value created here @@ -35,7 +35,7 @@ LL | s << &mut 3 //~ ERROR does not live long enough error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:58:5 | -LL | s.shl(&mut 3) //~ ERROR does not live long enough +LL | s.shl(&mut 3) | ^^^^^^^^^^^-^ | | | | | temporary value created here @@ -44,7 +44,7 @@ LL | s.shl(&mut 3) //~ ERROR does not live long enough error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:63:5 | -LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough +LL | S2::shl(s, &mut 3) | ^^^^^^^^^^^^^^^^-^ | | | | | temporary value created here diff --git a/src/test/ui/writing-to-immutable-vec.nll.stderr b/src/test/ui/writing-to-immutable-vec.nll.stderr index 6ec56f90ca4..a65765c86c8 100644 --- a/src/test/ui/writing-to-immutable-vec.nll.stderr +++ b/src/test/ui/writing-to-immutable-vec.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | LL | let v: Vec<isize> = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` -LL | v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable +LL | v[1] = 4; | ^ cannot borrow as mutable error: aborting due to previous error |
