mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-23 23:50:25 +08:00
17 lines
530 B
Plaintext
17 lines
530 B
Plaintext
$ cargo run
|
|
Compiling borrowing v0.1.0 (file:///projects/borrowing)
|
|
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
|
--> src/main.rs:3:13
|
|
|
|
|
2 | let x = 5;
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
3 | let y = &mut x;
|
|
| ^^^^^^ cannot borrow as mutable
|
|
|
|
error: aborting due to previous error
|
|
|
|
For more information about this error, try `rustc --explain E0596`.
|
|
error: could not compile `borrowing`
|
|
|
|
To learn more, run the command again with --verbose.
|