| 858 | #[test] |
| 859 | #[cfg_attr(miri, ignore)] |
| 860 | fn table_copy_doesnt_leak() -> Result<()> { |
| 861 | let _ = env_logger::try_init(); |
| 862 | |
| 863 | let mut store = Store::<()>::default(); |
| 864 | let flag = Arc::new(AtomicBool::new(false)); |
| 865 | |
| 866 | { |
| 867 | let mut scope = RootScope::new(&mut store); |
| 868 | let table = Table::new( |
| 869 | &mut scope, |
| 870 | TableType::new(RefType::EXTERNREF, 10, Some(10)), |
| 871 | Ref::Extern(None), |
| 872 | )?; |
| 873 | |
| 874 | let x = ExternRef::new(&mut scope, SetFlagOnDrop(flag.clone()))?; |
| 875 | table.fill(&mut scope, 2, x.into(), 3)?; |
| 876 | |
| 877 | Table::copy(&mut scope, &table, 0, &table, 5, 5)?; |
| 878 | } |
| 879 | |
| 880 | store.gc(None)?; |
| 881 | assert!(flag.load(SeqCst)); |
| 882 | Ok(()) |
| 883 | } |
| 884 | |
| 885 | #[test] |
| 886 | #[cfg_attr(miri, ignore)] |