diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-07-05 11:55:45 +0000 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-07-05 11:55:45 +0000 |
| commit | 3d20b2a14ffcf16687bcf9f93fb941fb36e92872 (patch) | |
| tree | b0bb3886926642d2b87a5044fae59ee5f5ca7f6f | |
| parent | 543ab9964065dc2b4e47d7bff5e83c84519f265e (diff) | |
| download | rust-3d20b2a14ffcf16687bcf9f93fb941fb36e92872.tar.gz rust-3d20b2a14ffcf16687bcf9f93fb941fb36e92872.zip | |
Test ManuallyDrop::clone_from.
| -rw-r--r-- | library/core/tests/manually_drop.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/tests/manually_drop.rs b/library/core/tests/manually_drop.rs index 77a338daf7d..9eac279733a 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<ManuallyDrop<[TypeWithDrop]>> = 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); } |
