2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2014-03-05 23:28:08 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2021-08-25 00:39:40 +00:00
|
|
|
let mut a: Vec<Box<_>> = vec![Box::new(10)];
|
2013-03-15 22:27:15 +00:00
|
|
|
let b = a.clone();
|
2011-09-27 00:16:34 +00:00
|
|
|
|
2014-10-15 06:05:01 +00:00
|
|
|
assert_eq!(*a[0], 10);
|
|
|
|
assert_eq!(*b[0], 10);
|
2011-09-27 00:16:34 +00:00
|
|
|
|
|
|
|
// This should only modify the value in a, not b
|
2014-11-06 17:25:16 +00:00
|
|
|
*a[0] = 20;
|
2011-09-27 00:16:34 +00:00
|
|
|
|
2014-10-15 06:05:01 +00:00
|
|
|
assert_eq!(*a[0], 20);
|
|
|
|
assert_eq!(*b[0], 10);
|
2012-12-06 00:51:32 +00:00
|
|
|
}
|