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

Function array_new_cross_store_initial_elem

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

Source from the content-addressed store, hash-verified

54#[test]
55#[should_panic = "wrong store"]
56fn 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"]

Callers

nothing calls this directly

Calls 5

gc_storeFunction · 0.85
newFunction · 0.50
ValTypeEnum · 0.50
unwrapMethod · 0.45
engineMethod · 0.45

Tested by

no test coverage detected