mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
618 B
16 lines
618 B
$ cargo run
|
|
Compiling ownership v0.1.0 (file:///projects/ownership)
|
|
error[E0596]: cannot borrow `*some_string` as mutable, as it is behind a `&` reference
|
|
--> src/main.rs:8:5
|
|
|
|
|
8 | some_string.push_str(", world");
|
|
| ^^^^^^^^^^^ `some_string` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
|
|
|
|
help: consider changing this to be a mutable reference
|
|
|
|
|
7 | fn change(some_string: &mut String) {
|
|
| +++
|
|
|
|
For more information about this error, try `rustc --explain E0596`.
|
|
error: could not compile `ownership` (bin "ownership") due to 1 previous error
|