MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / dtor_runs

Function dtor_runs

tests/all/func.rs:509–528  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

507
508#[test]
509fn 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)]

Callers

nothing calls this directly

Calls 2

newFunction · 0.50
dropFunction · 0.50

Tested by

no test coverage detected