Skip to content

Commit 2d5e085

Browse files
committed
Add a test that unique boxes in vectors are copied when the vector is
Issue #409
1 parent a88d9ef commit 2d5e085

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
fn main() {
2+
let a = [~mutable 10];
3+
let b = a;
4+
5+
assert *a[0] == 10;
6+
assert *b[0] == 10;
7+
8+
// This should only modify the value in a, not b
9+
*a[0] = 20;
10+
11+
assert *a[0] == 20;
12+
assert *b[0] == 10;
13+
}

0 commit comments

Comments
 (0)