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

Function array_new_fixed_cross_store_initial_elem

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

Source from the content-addressed store, hash-verified

139#[test]
140#[should_panic = "wrong store"]
141fn 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"]

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