summaryrefslogtreecommitdiffstats
path: root/src/test/ui/zero-sized/zero-size-type-destructors.rs
blob: fb87d8ea0ba7f0a52df9e639785492a6205f2289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
}