15 lines
234 B
Rust
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]));
|
|
}
|