rust/tests/ui/box/unit/unique-decl-init-copy.rs
2024-02-16 20:02:50 +00:00

12 lines
190 B
Rust

//@ run-pass
pub fn main() {
let mut i: Box<_> = Box::new(1);
// Should be a copy
let mut j = i.clone();
*i = 2;
*j = 3;
assert_eq!(*i, 2);
assert_eq!(*j, 3);
}