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

Function array_set_given_unrooted

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

Source from the content-addressed store, hash-verified

368
369#[test]
370fn array_set_given_unrooted() -> Result<()> {
371 let mut store = gc_store()?;
372
373 let array_ty = ArrayType::new(
374 store.engine(),
375 FieldType::new(Mutability::Var, ValType::ANYREF.into()),
376 );
377 let pre = ArrayRefPre::new(&mut store, array_ty);
378
379 let array = ArrayRef::new_fixed(&mut store, &pre, &[Val::AnyRef(None)])?;
380
381 let anyref = {
382 let mut scope = RootScope::new(&mut store);
383 AnyRef::from_i31(&mut scope, I31::new_i32(1234).unwrap())
384 };
385
386 assert!(array.set(&mut store, 0, anyref.into()).is_err());
387 Ok(())
388}
389
390#[test]
391#[should_panic = "wrong store"]

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected