| 139 | #[test] |
| 140 | #[should_panic = "wrong store"] |
| 141 | fn array_new_fixed_cross_store_initial_elem() { |
| 142 | let mut store1 = gc_store().unwrap(); |
| 143 | let mut store2 = gc_store().unwrap(); |
| 144 | |
| 145 | let array_ty = ArrayType::new( |
| 146 | store1.engine(), |
| 147 | FieldType::new(Mutability::Var, StorageType::ValType(ValType::ANYREF)), |
| 148 | ); |
| 149 | let pre = ArrayRefPre::new(&mut store1, array_ty); |
| 150 | |
| 151 | // Passing an `anyref` from a different store to `ArrayRef::new_fixed` |
| 152 | // results in a panic. |
| 153 | let anyref = AnyRef::from_i31(&mut store2, I31::new_i32(1234).unwrap()); |
| 154 | ArrayRef::new_fixed(&mut store1, &pre, &[anyref.into()]).unwrap(); |
| 155 | } |
| 156 | |
| 157 | #[test] |
| 158 | #[should_panic = "wrong store"] |