Test ManuallyDrop::clone_from.

This commit is contained in:
Mara Bos 2021-07-05 11:55:45 +00:00
parent 543ab99640
commit 3d20b2a14f

View File

@ -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);
}