From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/run-pass-valgrind/dst-dtor-2.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/run-pass-valgrind/dst-dtor-2.rs (limited to 'tests/run-pass-valgrind/dst-dtor-2.rs') diff --git a/tests/run-pass-valgrind/dst-dtor-2.rs b/tests/run-pass-valgrind/dst-dtor-2.rs new file mode 100644 index 000000000..991fe0095 --- /dev/null +++ b/tests/run-pass-valgrind/dst-dtor-2.rs @@ -0,0 +1,21 @@ +static mut DROP_RAN: isize = 0; + +struct Foo; +impl Drop for Foo { + fn drop(&mut self) { + unsafe { DROP_RAN += 1; } + } +} + +struct Fat { + f: T +} + +pub fn main() { + { + let _x: Box> = Box::>::new(Fat { f: [Foo, Foo, Foo] }); + } + unsafe { + assert_eq!(DROP_RAN, 3); + } +} -- cgit v1.2.3