fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.2 KiB27 linesraw
1error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
2  --> $DIR/mut-arg-hint.rs:3:9
3   |
4LL |     fn foo(mut a: &String) {
5   |                   ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
6LL |         a.push_str("bar");
7   |         ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
8
9error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
10  --> $DIR/mut-arg-hint.rs:8:5
11   |
12LL | pub fn foo<'a>(mut a: &'a String) {
13   |                       ---------- help: consider changing this to be a mutable reference: `&'a mut String`
14LL |     a.push_str("foo");
15   |     ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
16
17error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
18  --> $DIR/mut-arg-hint.rs:15:9
19   |
20LL |     pub fn foo(mut a: &String) {
21   |                       ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
22LL |         a.push_str("foo");
23   |         ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
24
25error: aborting due to 3 previous errors
26
27For more information about this error, try `rustc --explain E0596`.