]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/pass/drop_through_owned_slice.rs
Auto merge of #104915 - weihanglo:update-cargo, r=ehuss
[rust.git] / src / tools / miri / tests / pass / drop_through_owned_slice.rs
1 struct Bar;
2
3 static mut DROP_COUNT: usize = 0;
4
5 impl Drop for Bar {
6     fn drop(&mut self) {
7         unsafe {
8             DROP_COUNT += 1;
9         }
10     }
11 }
12
13 fn main() {
14     let b: Box<[Bar]> = vec![Bar, Bar, Bar, Bar].into_boxed_slice();
15     assert_eq!(unsafe { DROP_COUNT }, 0);
16     drop(b);
17     assert_eq!(unsafe { DROP_COUNT }, 4);
18 }