| 2559 | |
| 2560 | #[test] |
| 2561 | fn anyref_to_raw_struct() -> Result<()> { |
| 2562 | let mut store = gc_store()?; |
| 2563 | let struct_ty = StructType::new( |
| 2564 | store.engine(), |
| 2565 | [FieldType::new(Mutability::Const, ValType::I32.into())], |
| 2566 | )?; |
| 2567 | let pre = StructRefPre::new(&mut store, struct_ty); |
| 2568 | let s = StructRef::new(&mut store, &pre, &[Val::I32(99)])?; |
| 2569 | let any: Rooted<AnyRef> = s.into(); |
| 2570 | // to_raw on a non-i31 anyref exercises the else-branch in to_raw |
| 2571 | let raw = any.to_raw(&mut store)?; |
| 2572 | assert_ne!(raw, 0); |
| 2573 | Ok(()) |
| 2574 | } |
| 2575 | |
| 2576 | #[test] |
| 2577 | fn externref_data_some() -> Result<()> { |