fork/rust

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

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

1.39.0
1008 B27 linesraw
1error[E0596]: cannot borrow data in a `&` reference as mutable
2  --> $DIR/dont-print-desugared.rs:4:10
3   |
4LL |     for &ref mut x in s {}
5   |         -^^^^^^^^^
6   |         ||
7   |         |cannot borrow as mutable through `&` reference
8   |         help: consider changing this to be a mutable reference: `&mut ref mut x`
9
10error[E0597]: `y` does not live long enough
11  --> $DIR/dont-print-desugared.rs:17:16
12   |
13LL |     for ref mut d in v {
14   |                      - a temporary with access to the borrow is created here ...
15LL |         let y = ();
16LL |         *d = D(&y);
17   |                ^^ borrowed value does not live long enough
18LL |     }
19   |     -
20   |     |
21   |     `y` dropped here while still borrowed
22   |     ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
23
24error: aborting due to 2 previous errors
25
26Some errors have detailed explanations: E0596, E0597.
27For more information about an error, try `rustc --explain E0596`.