fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.3 KiB40 linesraw
1error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
2  --> $DIR/borrowck-report-with-custom-diagnostic.rs:8:13
3   |
4LL |     let y = &mut x;
5   |             ------ mutable borrow occurs here
6LL |
7LL |     let z = &x;
8   |             ^^ immutable borrow occurs here
9...
10LL |     y.use_mut();
11   |     - mutable borrow later used here
12
13error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
14  --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
15   |
16LL |             let y = &x;
17   |                     -- immutable borrow occurs here
18LL |
19LL |             let z = &mut x;
20   |                     ^^^^^^ mutable borrow occurs here
21...
22LL |             y.use_ref();
23   |             - immutable borrow later used here
24
25error[E0499]: cannot borrow `x` as mutable more than once at a time
26  --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
27   |
28LL |         let y = &mut x;
29   |                 ------ first mutable borrow occurs here
30LL |
31LL |         let z = &mut x;
32   |                 ^^^^^^ second mutable borrow occurs here
33...
34LL |         y.use_mut();
35   |         - first borrow later used here
36
37error: aborting due to 3 previous errors
38
39Some errors have detailed explanations: E0499, E0502.
40For more information about an error, try `rustc --explain E0499`.