mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Test ManuallyDrop::clone_from.
This commit is contained in:
parent
543ab99640
commit
3d20b2a14f
@ -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…
Reference in New Issue
Block a user