rust/src/test/ui/borrowck/borrowck-describe-lvalue.stderr

375 lines
13 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-describe-lvalue.rs:262:13
2018-08-08 07:28:26 -05:00
|
LL | let y = &mut x;
| ------ first mutable borrow occurs here
LL | &mut x;
2018-08-08 07:28:26 -05:00
| ^^^^^^ second mutable borrow occurs here
LL | *y = 1;
| ------ first borrow later used here
2018-08-08 07:28:26 -05:00
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-describe-lvalue.rs:272:20
2018-08-08 07:28:26 -05:00
|
LL | let y = &mut x;
| ------ first mutable borrow occurs here
LL | &mut x;
2018-08-08 07:28:26 -05:00
| ^^^^^^ second mutable borrow occurs here
LL | *y = 1;
| ------ first borrow later used here
2018-08-08 07:28:26 -05:00
error: captured variable cannot escape `FnMut` closure body
--> $DIR/borrowck-describe-lvalue.rs:270:16
2018-08-08 07:28:26 -05:00
|
LL | || {
| - inferred to be a `FnMut` closure
LL | / || {
LL | | let y = &mut x;
LL | | &mut x;
LL | | *y = 1;
LL | | drop(y);
LL | | }
| |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
2018-08-08 07:28:26 -05:00
error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:41:9
2018-08-08 07:28:26 -05:00
|
LL | let x = f.x();
| - borrow of `f` occurs here
LL | f.x;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `f`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:48:9
2018-08-08 07:28:26 -05:00
|
LL | let x = g.x();
| - borrow of `g` occurs here
LL | g.0;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `g`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `h.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:55:9
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut h.0;
| -------- borrow of `h.0` occurs here
LL | h.0;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `h.0`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:63:20
2018-08-08 07:28:26 -05:00
|
LL | let x = e.x();
| - borrow of `e` occurs here
2018-09-13 16:04:09 -05:00
LL | match e {
2018-08-08 07:28:26 -05:00
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `e`
LL | };
2018-08-08 07:28:26 -05:00
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `u.a` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:71:9
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut u.a;
| -------- borrow of `u.a` occurs here
LL | u.a;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `u.a`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:78:9
2018-08-08 07:28:26 -05:00
|
LL | let x = f.x();
| - borrow of `*f` occurs here
LL | f.x;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `*f`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:85:9
2018-08-08 07:28:26 -05:00
|
LL | let x = g.x();
| - borrow of `*g` occurs here
LL | g.0;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `*g`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `h.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:92:9
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut h.0;
| -------- borrow of `h.0` occurs here
LL | h.0;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `h.0`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:100:20
2018-08-08 07:28:26 -05:00
|
LL | let x = e.x();
| - borrow of `*e` occurs here
2018-09-13 16:04:09 -05:00
LL | match *e {
2018-08-08 07:28:26 -05:00
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `*e`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `u.a` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:109:9
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut u.a;
| -------- borrow of `u.a` occurs here
LL | u.a;
2018-08-08 07:28:26 -05:00
| ^^^ use of borrowed `u.a`
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:117:15
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
2018-09-13 16:04:09 -05:00
LL | match v {
2018-08-08 07:28:26 -05:00
LL | &[x, _, .., _, _] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:122:18
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x, .., _, _] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:127:25
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, _, .., x, _] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:132:28
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, _, .., _, x] => println!("{}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:143:15
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
2018-09-13 16:04:09 -05:00
LL | match v {
2018-08-08 07:28:26 -05:00
LL | &[x..] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:148:18
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x..] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:153:15
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[x.., _] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `v[..]` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:158:18
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
...
LL | &[_, x.., _] => println!("{:?}", x),
| ^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0503]: cannot use `e` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:171:13
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut e;
| ------ borrow of `e` occurs here
2018-09-13 16:04:09 -05:00
LL | match e {
2018-08-08 07:28:26 -05:00
LL | E::A(ref ax) =>
| ^^^^^^^^^^^^ use of borrowed `e`
...
LL | drop(x);
| - borrow later used here
error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:171:18
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut e;
| ------ mutable borrow occurs here
2018-09-13 16:04:09 -05:00
LL | match e {
2018-08-08 07:28:26 -05:00
LL | E::A(ref ax) =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
2018-08-08 07:28:26 -05:00
error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:175:23
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut e;
| ------ mutable borrow occurs here
...
LL | E::B { x: ref bx } =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
2018-08-08 07:28:26 -05:00
error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:188:22
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut s;
| ------ mutable borrow occurs here
2018-09-13 16:04:09 -05:00
LL | match s {
2018-08-08 07:28:26 -05:00
LL | S { y: (ref y0, _), .. } =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
2018-08-08 07:28:26 -05:00
error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:194:28
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut s;
| ------ mutable borrow occurs here
...
LL | S { x: F { y: ref x0, .. }, .. } =>
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
2018-08-08 07:28:26 -05:00
error[E0503]: cannot use `*v` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:240:9
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
LL | v[0].y;
| ^^^^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
2018-12-27 05:08:51 -06:00
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:240:9
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ borrow of `v` occurs here
LL | v[0].y;
| ^^^^^^ use of borrowed `v`
...
LL | drop(x);
| - borrow later used here
error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:251:24
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut v;
| ------ mutable borrow occurs here
2018-09-13 16:04:09 -05:00
LL | match v {
2018-08-08 07:28:26 -05:00
LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
| ^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
2018-08-08 07:28:26 -05:00
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:210:29
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut block;
| ---------- mutable borrow occurs here
LL | let p: &'a u8 = &*block.current;
| ^^^^^^^^^^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
|
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
2019-05-13 19:09:30 -05:00
= note: for more information, try `rustc --explain E0729`
2018-08-08 07:28:26 -05:00
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:227:33
2018-08-08 07:28:26 -05:00
|
LL | let x = &mut block;
| ---------- mutable borrow occurs here
LL | let p : *const u8 = &*(*block).current;
| ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
...
LL | drop(x);
| - mutable borrow later used here
|
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
2019-05-13 19:09:30 -05:00
= note: for more information, try `rustc --explain E0729`
2018-08-08 07:28:26 -05:00
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-describe-lvalue.rs:282:22
2018-08-08 07:28:26 -05:00
|
LL | drop(x);
| - value moved here
LL | drop(x);
2018-08-08 07:28:26 -05:00
| ^ value used here after move
|
= note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error: aborting due to 30 previous errors
2018-08-08 07:28:26 -05:00
Some errors have detailed explanations: E0382, E0499, E0502, E0503.
2018-08-08 07:28:26 -05:00
For more information about an error, try `rustc --explain E0382`.