fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
1.2 KiB41 linesraw
1error[E0515]: cannot return reference to local variable `x`
2  --> $DIR/polonius-smoke-test.rs:7:5
3   |
4LL |     &x
5   |     ^^ returns a reference to data owned by the current function
6
7error[E0503]: cannot use `x` because it was mutably borrowed
8  --> $DIR/polonius-smoke-test.rs:13:13
9   |
10LL |     let y = &mut x;
11   |             ------ borrow of `x` occurs here
12LL |     let z = x;
13   |             ^ use of borrowed `x`
14LL |     let w = y;
15   |             - borrow later used here
16
17error[E0505]: cannot move out of `x` because it is borrowed
18  --> $DIR/polonius-smoke-test.rs:19:13
19   |
20LL |     let y = &mut *x;
21   |             ------- borrow of `*x` occurs here
22LL |     let z = x;
23   |             ^ move out of `x` occurs here
24LL |     y
25   |     - borrow later used here
26
27error[E0505]: cannot move out of `s` because it is borrowed
28  --> $DIR/polonius-smoke-test.rs:43:5
29   |
30LL |     let r = &mut *s;
31   |             ------- borrow of `*s` occurs here
32LL |     let tmp = foo(&r);
33LL |     s;
34   |     ^ move out of `s` occurs here
35LL |     tmp;
36   |     --- borrow later used here
37
38error: aborting due to 4 previous errors
39
40Some errors have detailed explanations: E0503, E0505, E0515.
41For more information about an error, try `rustc --explain E0503`.