rust/src/test/run-fail/borrowck-wg-two-array-indices.rs
2013-09-26 17:05:59 -07:00

18 lines
283 B
Rust

// error-pattern:borrowed
// Test that arguments trigger when there are *two mutable* borrows
// of indices.
fn add(x:&mut int, y:&mut int)
{
*x = *x + *y;
}
pub fn main()
{
let z = @mut [1,2,3];
let z2 = z;
add(&mut z[0], &mut z2[0]);
println!("{}", z[0]);
}