Files
rust/tests/ui/box/unit/unique-in-vec-copy.rs

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

16 lines
284 B
Rust
Raw Normal View History

//@ run-pass
pub fn main() {
let mut a: Vec<Box<_>> = vec![Box::new(10)];
2013-03-15 18:27:15 -04: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 12:25:16 -05:00
*a[0] = 20;
assert_eq!(*a[0], 20);
assert_eq!(*b[0], 10);
2012-12-05 16:51:32 -08:00
}