Test ManuallyDrop::clone_from.
This commit is contained in:
parent
543ab99640
commit
3d20b2a14f
1 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue