Isn't this MutableVector's mut_split_at <http://doc.rust-lang.org/std/slice/trait.MutableVector.html#tymethod.mut_split_at> that we already have?
On Mon, Jun 2, 2014 at 8:25 AM, Patrick Walton <[email protected]> wrote: > On 6/2/14 12:44 AM, Tommi wrote: > >> In my original post I stated that it feels like there's something wrong >> with the language when it doesn't allow multiple mutable references to >> the same data, but I didn't really explain why it feels like that. So, I >> just want to add this simple example to help explain my position. It is >> just plain obvious to everybody that the following code snippet is >> memory-safe, but the compiler refuses to compile it due to "cannot >> borrow `stuff[..]` as mutable more than once at a time": >> >> let mut stuff = [1, 2, 3]; >> let r1 = stuff.mut_slice_to(2); >> let r2 = stuff.mut_slice_from(1); >> > > I'd like to have a function that splits up a vector in that way. That > should be doable in the standard library using some unsafe code under the > hood. > > Patrick > > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
