2013-05-03 16:26:43 -04:00
|
|
|
// 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]);
|
2013-07-22 19:04:51 +03:00
|
|
|
printfln!("%d", z[0]);
|
2013-05-03 16:26:43 -04:00
|
|
|
}
|