Skip to content

Commit c630b6b

Browse files
authored
Rollup merge of rust-lang#86880 - m-ou-se:test-manuallydrop-clone-from, r=Mark-Simulacrum
Test ManuallyDrop::clone_from. See rust-lang#86288
2 parents cbb40cd + 3d20b2a commit c630b6b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/core/tests/manually_drop.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use core::mem::ManuallyDrop;
22

33
#[test]
44
fn smoke() {
5+
#[derive(Clone)]
56
struct TypeWithDrop;
67
impl Drop for TypeWithDrop {
78
fn drop(&mut self) {
@@ -16,4 +17,11 @@ fn smoke() {
1617
let x: Box<ManuallyDrop<[TypeWithDrop]>> =
1718
Box::new(ManuallyDrop::new([TypeWithDrop, TypeWithDrop]));
1819
drop(x);
20+
21+
// test clone and clone_from implementations
22+
let mut x = ManuallyDrop::new(TypeWithDrop);
23+
let y = x.clone();
24+
x.clone_from(&y);
25+
drop(x);
26+
drop(y);
1927
}

0 commit comments

Comments
 (0)