rust/src/test/run-pass/borrowck-wg-two-imm-borrows.rs
2013-09-26 17:05:59 -07:00

15 lines
229 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]);
println!("{}", z[0]);
}