()
| 507 | |
| 508 | #[test] |
| 509 | fn dtor_runs() { |
| 510 | static HITS: AtomicUsize = AtomicUsize::new(0); |
| 511 | |
| 512 | struct A; |
| 513 | |
| 514 | impl Drop for A { |
| 515 | fn drop(&mut self) { |
| 516 | HITS.fetch_add(1, SeqCst); |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | let mut store = Store::<()>::default(); |
| 521 | let a = A; |
| 522 | assert_eq!(HITS.load(SeqCst), 0); |
| 523 | Func::wrap(&mut store, move || { |
| 524 | let _ = &a; |
| 525 | }); |
| 526 | drop(store); |
| 527 | assert_eq!(HITS.load(SeqCst), 1); |
| 528 | } |
| 529 | |
| 530 | #[test] |
| 531 | #[cfg_attr(miri, ignore)] |