| 390 | #[test] |
| 391 | #[should_panic = "wrong store"] |
| 392 | fn array_set_cross_store_value() { |
| 393 | let mut store1 = gc_store().unwrap(); |
| 394 | let mut store2 = gc_store().unwrap(); |
| 395 | |
| 396 | let array_ty = ArrayType::new( |
| 397 | store1.engine(), |
| 398 | FieldType::new(Mutability::Var, ValType::ANYREF.into()), |
| 399 | ); |
| 400 | let pre = ArrayRefPre::new(&mut store1, array_ty); |
| 401 | |
| 402 | let array = ArrayRef::new_fixed(&mut store1, &pre, &[Val::AnyRef(None)]).unwrap(); |
| 403 | |
| 404 | let anyref = AnyRef::from_i31(&mut store2, I31::new_i32(1234).unwrap()); |
| 405 | |
| 406 | // Should panic. |
| 407 | let _ = array.set(&mut store1, 0, anyref.into()); |
| 408 | } |
| 409 | |
| 410 | #[test] |
| 411 | fn array_set_immutable_elems() -> Result<()> { |