blob: 2d1d876e6f23982ea0374c756ede1f25fe212294 [file] [log] [blame]
#![allow(static_mut_refs)]
struct Bar;
static mut DROP_COUNT: usize = 0;
impl Drop for Bar {
fn drop(&mut self) {
unsafe {
DROP_COUNT += 1;
}
}
}
fn main() {
let b: Box<[Bar]> = vec![Bar, Bar, Bar, Bar].into_boxed_slice();
assert_eq!(unsafe { DROP_COUNT }, 0);
drop(b);
assert_eq!(unsafe { DROP_COUNT }, 4);
}