Add a test that unique boxes in vectors are copied when the vector is
Issue #409
This commit is contained in:
parent
a88d9effbc
commit
2d5e085eb9
1 changed files with 13 additions and 0 deletions
13
src/test/run-pass/unique-in-vec-copy.rs
Normal file
13
src/test/run-pass/unique-in-vec-copy.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
fn main() {
|
||||
let a = [~mutable 10];
|
||||
let b = a;
|
||||
|
||||
assert *a[0] == 10;
|
||||
assert *b[0] == 10;
|
||||
|
||||
// This should only modify the value in a, not b
|
||||
*a[0] = 20;
|
||||
|
||||
assert *a[0] == 20;
|
||||
assert *b[0] == 10;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue