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

Function array_new_fixed_unrooted_initial_elem

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

Source from the content-addressed store, hash-verified

119
120#[test]
121fn array_new_fixed_unrooted_initial_elem() -> Result<()> {
122 let mut store = gc_store()?;
123 let array_ty = ArrayType::new(
124 store.engine(),
125 FieldType::new(Mutability::Var, StorageType::ValType(ValType::ANYREF)),
126 );
127 let pre = ArrayRefPre::new(&mut store, array_ty);
128
129 // Passing an unrooted `anyref` to `StructRef::new` results in an error.
130 let anyref = {
131 let mut scope = RootScope::new(&mut store);
132 AnyRef::from_i31(&mut scope, I31::new_i32(1234).unwrap())
133 };
134
135 assert!(ArrayRef::new_fixed(&mut store, &pre, &[anyref.into()]).is_err());
136 Ok(())
137}
138
139#[test]
140#[should_panic = "wrong store"]

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected