]>
Commit | Line | Data |
---|---|---|
74b04a01 XL |
1 | $ cargo run |
2 | Compiling unsafe-example v0.1.0 (file:///projects/unsafe-example) | |
3 | error[E0499]: cannot borrow `*slice` as mutable more than once at a time | |
4 | --> src/main.rs:6:30 | |
5 | | | |
6 | 1 | fn split_at_mut(slice: &mut [i32], mid: usize) -> (&mut [i32], &mut [i32]) { | |
7 | | - let's call the lifetime of this reference `'1` | |
8 | ... | |
9 | 6 | (&mut slice[..mid], &mut slice[mid..]) | |
10 | | -------------------------^^^^^-------- | |
11 | | | | | | |
12 | | | | second mutable borrow occurs here | |
13 | | | first mutable borrow occurs here | |
14 | | returning this value requires that `*slice` is borrowed for `'1` | |
15 | ||
16 | error: aborting due to previous error | |
17 | ||
18 | For more information about this error, try `rustc --explain E0499`. | |
fc512014 | 19 | error: could not compile `unsafe-example` |
74b04a01 XL |
20 | |
21 | To learn more, run the command again with --verbose. |