fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.2 KiB29 linesraw
1error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
2  --> $DIR/issue-62387-suggest-iter-mut.rs:18:27
3   |
4LL |     v.iter().for_each(|a| a.double());
5   |                        -  ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
6   |                        |
7   |                        consider changing this binding's type to be: `&mut A`
8   |
9help: you may want to use `iter_mut` here
10   |
11LL |     v.iter_mut().for_each(|a| a.double());
12   |       ~~~~~~~~
13
14error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
15  --> $DIR/issue-62387-suggest-iter-mut.rs:25:39
16   |
17LL |     v.iter().rev().rev().for_each(|a| a.double());
18   |                                    -  ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
19   |                                    |
20   |                                    consider changing this binding's type to be: `&mut A`
21   |
22help: you may want to use `iter_mut` here
23   |
24LL |     v.iter_mut().rev().rev().for_each(|a| a.double());
25   |       ~~~~~~~~
26
27error: aborting due to 2 previous errors
28
29For more information about this error, try `rustc --explain E0596`.