summaryrefslogtreecommitdiffstats
path: root/src/test/ui/zero-sized/zero-size-type-destructors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/zero-sized/zero-size-type-destructors.rs')
-rw-r--r--src/test/ui/zero-sized/zero-size-type-destructors.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/zero-sized/zero-size-type-destructors.rs b/src/test/ui/zero-sized/zero-size-type-destructors.rs
new file mode 100644
index 000000000..fb87d8ea0
--- /dev/null
+++ b/src/test/ui/zero-sized/zero-size-type-destructors.rs
@@ -0,0 +1,21 @@
+// run-pass
+#![allow(non_upper_case_globals)]
+
+static mut destructions : isize = 3;
+
+pub fn foo() {
+ struct Foo;
+
+ impl Drop for Foo {
+ fn drop(&mut self) {
+ unsafe { destructions -= 1 };
+ }
+ }
+
+ let _x = [Foo, Foo, Foo];
+}
+
+pub fn main() {
+ foo();
+ assert_eq!(unsafe { destructions }, 0);
+}