2018-07-27 12:12:55 +02:00
|
|
|
use core::mem::ManuallyDrop;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn smoke() {
|
|
|
|
struct TypeWithDrop;
|
|
|
|
impl Drop for TypeWithDrop {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
unreachable!("Should not get dropped");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let x = ManuallyDrop::new(TypeWithDrop);
|
|
|
|
drop(x);
|
2018-08-03 18:02:34 +02:00
|
|
|
|
|
|
|
// also test unsizing
|
2019-12-07 05:18:12 +01:00
|
|
|
let x: Box<ManuallyDrop<[TypeWithDrop]>> =
|
2018-08-06 15:52:36 +02:00
|
|
|
Box::new(ManuallyDrop::new([TypeWithDrop, TypeWithDrop]));
|
2018-08-03 18:02:34 +02:00
|
|
|
drop(x);
|
2018-07-27 12:12:55 +02:00
|
|
|
}
|