1
Fork 0

Update NLL tests

This commit is contained in:
Vadim Petrochenkov 2019-03-11 23:18:35 +03:00
parent fa72a81bea
commit c1cfacfb13
287 changed files with 794 additions and 794 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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`

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)));

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
| |

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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`

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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
|

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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 }] => {
|

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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>`

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more