Skip to content

Commit

Permalink
Rollup merge of #86880 - m-ou-se:test-manuallydrop-clone-from, r=Mark…
Browse files Browse the repository at this point in the history
…-Simulacrum

Test ManuallyDrop::clone_from.

See #86288
  • Loading branch information
JohnTitor authored Jul 7, 2021
2 parents cbb40cd + 3d20b2a commit c630b6b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/core/tests/manually_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use core::mem::ManuallyDrop;

#[test]
fn smoke() {
#[derive(Clone)]
struct TypeWithDrop;
impl Drop for TypeWithDrop {
fn drop(&mut self) {
Expand All @@ -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);
}

0 comments on commit c630b6b

Please sign in to comment.