You should use a mutable borrow of the vector rather than a mutable borrow of a pointer to a vector, so you should get rid of that ~
pointer in the type of your partition function. For example:
fn partition(_: &mut [uint], _: uint, _: uint) { }
fn main() {
let mut array = ~[1, 2, 3, 4, 3, 2, 1];
partition(array, 0, 0);
}
Notice that array
is automatically passed as a mutable borrowed pointer.
If you use a Vec
instead, then you need to explicitly create a slice:
fn partition(_: &mut [uint], _: uint, _: uint) { }
fn main() {
let mut array = vec!(1, 2, 3, 4, 3, 2, 1);
partition(array.as_mut_slice(), 0, 0);
}
Both code snippets should compile on the latest Rust (from tip).