rust/tests/ui/unique/unique-in-vec-copy.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
283 B
Rust
Raw Normal View History

// run-pass
pub fn main() {
let mut a: Vec<Box<_>> = vec![Box::new(10)];
2013-03-15 22:27:15 +00:00
let b = a.clone();
assert_eq!(*a[0], 10);
assert_eq!(*b[0], 10);
// This should only modify the value in a, not b
2014-11-06 17:25:16 +00:00
*a[0] = 20;
assert_eq!(*a[0], 20);
assert_eq!(*b[0], 10);
2012-12-06 00:51:32 +00:00
}