| 807 | |
| 808 | #[test] |
| 809 | fn structref_owned_to_eqref() -> Result<()> { |
| 810 | let mut store = gc_store()?; |
| 811 | let struct_ty = StructType::new( |
| 812 | store.engine(), |
| 813 | [FieldType::new(Mutability::Const, ValType::I32.into())], |
| 814 | )?; |
| 815 | let pre = StructRefPre::new(&mut store, struct_ty); |
| 816 | let s = StructRef::new(&mut store, &pre, &[Val::I32(5)])?; |
| 817 | let owned = s.to_owned_rooted(&mut store)?; |
| 818 | |
| 819 | // OwnedRooted<StructRef>::to_eqref upcast |
| 820 | let eq_owned: OwnedRooted<EqRef> = owned.to_eqref(); |
| 821 | let eq = eq_owned.to_rooted(&mut store); |
| 822 | assert!(eq.is_struct(&store)?); |
| 823 | |
| 824 | Ok(()) |
| 825 | } |
| 826 | |
| 827 | #[test] |
| 828 | fn structref_ty() -> Result<()> { |