summaryrefslogtreecommitdiffstats
path: root/src/test/run-pass-valgrind/dst-dtor-3.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/run-pass-valgrind/dst-dtor-3.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/run-pass-valgrind/dst-dtor-3.rs b/src/test/run-pass-valgrind/dst-dtor-3.rs
new file mode 100644
index 000000000..f0c2dda5a
--- /dev/null
+++ b/src/test/run-pass-valgrind/dst-dtor-3.rs
@@ -0,0 +1,22 @@
+#![feature(unsized_tuple_coercion)]
+
+static mut DROP_RAN: bool = false;
+
+struct Foo;
+impl Drop for Foo {
+ fn drop(&mut self) {
+ unsafe { DROP_RAN = true; }
+ }
+}
+
+trait Trait { fn dummy(&self) { } }
+impl Trait for Foo {}
+
+pub fn main() {
+ {
+ let _x: Box<(i32, Trait)> = Box::<(i32, Foo)>::new((42, Foo));
+ }
+ unsafe {
+ assert!(DROP_RAN);
+ }
+}