]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unique/unique-in-vec-copy.rs
Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync
[rust.git] / src / test / ui / unique / unique-in-vec-copy.rs
1 // run-pass
2
3 pub fn main() {
4     let mut a: Vec<Box<_>> = vec![Box::new(10)];
5     let b = a.clone();
6
7     assert_eq!(*a[0], 10);
8     assert_eq!(*b[0], 10);
9
10     // This should only modify the value in a, not b
11     *a[0] = 20;
12
13     assert_eq!(*a[0], 20);
14     assert_eq!(*b[0], 10);
15 }