2022-02-06 16:43:51 +08:00
|
|
|
$ cargo run
|
|
|
|
Compiling ownership v0.1.0 (file:///projects/ownership)
|
|
|
|
error[E0499]: cannot borrow `s` as mutable more than once at a time
|
|
|
|
--> src/main.rs:5:14
|
|
|
|
|
|
|
|
|
4 | let r1 = &mut s;
|
|
|
|
| ------ first mutable borrow occurs here
|
|
|
|
5 | let r2 = &mut s;
|
|
|
|
| ^^^^^^ second mutable borrow occurs here
|
2023-01-16 17:34:52 +08:00
|
|
|
6 |
|
2022-02-06 16:43:51 +08:00
|
|
|
7 | println!("{}, {}", r1, r2);
|
|
|
|
| -- first borrow later used here
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0499`.
|
2024-06-06 21:23:21 +08:00
|
|
|
error: could not compile `ownership` (bin "ownership") due to 1 previous error
|