MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / array_set_cross_store_value

Function array_set_cross_store_value

tests/all/arrays.rs:392–408  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390#[test]
391#[should_panic = "wrong store"]
392fn 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]
411fn array_set_immutable_elems() -> Result<()> {

Callers

nothing calls this directly

Calls 6

gc_storeFunction · 0.85
newFunction · 0.50
AnyRefClass · 0.50
unwrapMethod · 0.45
engineMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected