trpl-zh-cn/listings/ch19-advanced-features/listing-19-05/output.txt

18 lines
825 B
Plaintext
Raw Normal View History

2022-02-06 16:43:51 +08:00
$ cargo run
Compiling unsafe-example v0.1.0 (file:///projects/unsafe-example)
2023-01-16 17:34:52 +08:00
error[E0499]: cannot borrow `*values` as mutable more than once at a time
--> src/main.rs:6:31
2022-02-06 16:43:51 +08:00
|
2023-01-16 17:34:52 +08:00
1 | fn split_at_mut(values: &mut [i32], mid: usize) -> (&mut [i32], &mut [i32]) {
| - let's call the lifetime of this reference `'1`
2022-02-06 16:43:51 +08:00
...
2023-01-16 17:34:52 +08:00
6 | (&mut values[..mid], &mut values[mid..])
| --------------------------^^^^^^--------
| | | |
| | | second mutable borrow occurs here
2022-02-06 16:43:51 +08:00
| | first mutable borrow occurs here
2023-01-16 17:34:52 +08:00
| returning this value requires that `*values` is borrowed for `'1`
2022-02-06 16:43:51 +08:00
For more information about this error, try `rustc --explain E0499`.
error: could not compile `unsafe-example` (bin "unsafe-example") due to 1 previous error