Skip to content

Commit 080f9d7

Browse files
committed
manual drop
1 parent 0285cae commit 080f9d7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

benches/prelude.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ fn manual_batch<T, U>(mut setup: impl FnMut() -> T, mut f: impl FnMut(T) -> U) -
7474
let input = unsafe { std::ptr::read(inputs.get_unchecked(i)) };
7575
let output = unsafe { out.get_unchecked_mut(i) };
7676
output.write(f(input));
77+
if std::mem::needs_drop::<T>() {
78+
unsafe { std::ptr::drop_in_place(input.as_mut_ptr()) };
79+
}
80+
if std::mem::needs_drop::<U>() {
81+
unsafe { std::ptr::drop_in_place(output.as_mut_ptr()) };
82+
}
7783
}
7884
}
7985
}

0 commit comments

Comments
 (0)