rust/tests/ui/nll/polonius/polonius-smoke-test.stderr

48 lines
1.6 KiB
Plaintext
Raw Normal View History

error[E0515]: cannot return reference to local variable `x`
2022-04-01 12:13:25 -05:00
--> $DIR/polonius-smoke-test.rs:6:5
|
2019-03-09 06:03:44 -06:00
LL | &x
| ^^ returns a reference to data owned by the current function
error[E0503]: cannot use `x` because it was mutably borrowed
2022-04-01 12:13:25 -05:00
--> $DIR/polonius-smoke-test.rs:12:13
|
LL | let y = &mut x;
2023-01-14 21:06:44 -06:00
| ------ `x` is borrowed here
2019-03-09 06:03:44 -06:00
LL | let z = x;
| ^ use of borrowed `x`
LL | let w = y;
| - borrow later used here
error[E0505]: cannot move out of `x` because it is borrowed
2022-04-01 12:13:25 -05:00
--> $DIR/polonius-smoke-test.rs:18:13
|
LL | pub fn use_while_mut_fr(x: &mut i32) -> &mut i32 {
| - - let's call the lifetime of this reference `'1`
| |
| binding `x` declared here
LL | let y = &mut *x;
| ------- borrow of `*x` occurs here
2019-03-09 06:03:44 -06:00
LL | let z = x;
| ^ move out of `x` occurs here
LL | y
| - returning this value requires that `*x` is borrowed for `'1`
error[E0505]: cannot move out of `s` because it is borrowed
2022-04-01 12:13:25 -05:00
--> $DIR/polonius-smoke-test.rs:42:5
|
LL | let s = &mut 1;
| - binding `s` declared here
LL | let r = &mut *s;
| ------- borrow of `*s` occurs here
LL | let tmp = foo(&r);
2019-03-09 06:03:44 -06:00
LL | s;
| ^ move out of `s` occurs here
LL | tmp;
| --- borrow later used here
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0503, E0505, E0515.
For more information about an error, try `rustc --explain E0503`.