rust/src/test/run-pass/borrowck-wg-two-imm-borrows.rs
2013-05-03 16:27:16 -04:00

15 lines
234 B
Rust

// Test that we can borrow the same @mut box twice, so long as both are imm.
fn add(x:&int, y:&int)
{
*x + *y;
}
pub fn main()
{
let z = @mut [1,2,3];
let z2 = z;
add(&z[0], &z2[0]);
print(fmt!("%d\n", z[0]));
}