| 54 | #[test] |
| 55 | #[should_panic = "wrong store"] |
| 56 | fn array_new_cross_store_initial_elem() { |
| 57 | let mut store1 = gc_store().unwrap(); |
| 58 | let mut store2 = gc_store().unwrap(); |
| 59 | |
| 60 | let array_ty = ArrayType::new( |
| 61 | store1.engine(), |
| 62 | FieldType::new(Mutability::Var, StorageType::ValType(ValType::ANYREF)), |
| 63 | ); |
| 64 | let pre = ArrayRefPre::new(&mut store1, array_ty); |
| 65 | |
| 66 | // Passing an `anyref` from a different store to `ArrayRef::new` results in |
| 67 | // a panic. |
| 68 | let anyref = AnyRef::from_i31(&mut store2, I31::new_i32(1234).unwrap()); |
| 69 | ArrayRef::new(&mut store1, &pre, &anyref.into(), 3).unwrap(); |
| 70 | } |
| 71 | |
| 72 | #[test] |
| 73 | #[should_panic = "wrong store"] |