fork/rust

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

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

1.43.0
780 B24 linesraw
1error[E0594]: cannot assign to `*x` which is behind a `&` reference
2  --> $DIR/issue-57989.rs:5:5
3   |
4LL | fn f(x: &i32) {
5   |         ---- help: consider changing this to be a mutable reference: `&mut i32`
6LL |     let g = &x;
7LL |     *x = 0;
8   |     ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
9
10error[E0506]: cannot assign to `*x` because it is borrowed
11  --> $DIR/issue-57989.rs:5:5
12   |
13LL |     let g = &x;
14   |             -- borrow of `*x` occurs here
15LL |     *x = 0;
16   |     ^^^^^^ assignment to borrowed `*x` occurs here
17LL |
18LL |     g;
19   |     - borrow later used here
20
21error: aborting due to 2 previous errors
22
23Some errors have detailed explanations: E0506, E0594.
24For more information about an error, try `rustc --explain E0506`.