diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-07-07 12:17:41 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-07 12:17:41 +0900 |
| commit | c630b6b0fc21bf8dfcd49d9e8e675bbde4822a17 (patch) | |
| tree | 8cc1e4a497649a065c78e1ea6983d5bc290000e9 | |
| parent | cbb40cd0f2157b93f6c7774d11bc9aa5a9882352 (diff) | |
| parent | 3d20b2a14ffcf16687bcf9f93fb941fb36e92872 (diff) | |
| download | rust-c630b6b0fc21bf8dfcd49d9e8e675bbde4822a17.tar.gz rust-c630b6b0fc21bf8dfcd49d9e8e675bbde4822a17.zip | |
Rollup merge of #86880 - m-ou-se:test-manuallydrop-clone-from, r=Mark-Simulacrum
Test ManuallyDrop::clone_from. See #86288
| -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); } |
