From 3d20b2a14ffcf16687bcf9f93fb941fb36e92872 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Mon, 5 Jul 2021 11:55:45 +0000 Subject: [PATCH] Test ManuallyDrop::clone_from. --- library/core/tests/manually_drop.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/core/tests/manually_drop.rs b/library/core/tests/manually_drop.rs index 77a338daf7dcb..9eac279733af9 100644 --- a/library/core/tests/manually_drop.rs +++ b/library/core/tests/manually_drop.rs @@ -2,6 +2,7 @@ use core::mem::ManuallyDrop; #[test] fn smoke() { + #[derive(Clone)] struct TypeWithDrop; impl Drop for TypeWithDrop { fn drop(&mut self) { @@ -16,4 +17,11 @@ fn smoke() { let x: Box> = Box::new(ManuallyDrop::new([TypeWithDrop, TypeWithDrop])); drop(x); + + // test clone and clone_from implementations + let mut x = ManuallyDrop::new(TypeWithDrop); + let y = x.clone(); + x.clone_from(&y); + drop(x); + drop(y); }