diff --git a/lib.rs b/lib.rs index 46090a8..09869cd 100644 --- a/lib.rs +++ b/lib.rs @@ -578,4 +578,21 @@ pub mod tests { assert_eq!(&v.iter().map(|v| **v).collect::>(), &[0, 3, 2]); } + + #[test] + #[should_panic] + fn test_drop_panic_smallvec() { + // This test should only panic once, and not double panic, + // which would mean a double drop + struct DropPanic; + + impl Drop for DropPanic { + fn drop(&mut self) { + panic!("drop"); + } + } + + let mut v = SmallVec::<[_; 1]>::new(); + v.push(DropPanic); + } }