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

Function panic_in_async_memory_limiter

tests/all/limits.rs:1043–1056  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1041#[should_panic(expected = "async resource limiter memory growing")]
1042#[cfg_attr(miri, ignore)]
1043async fn panic_in_async_memory_limiter() {
1044 let engine = Engine::default();
1045 let linker = Linker::<Panic>::new(&engine);
1046
1047 let module = Module::new(&engine, r#"(module (memory (export "m") 0))"#).unwrap();
1048
1049 let mut store = Store::new(&engine, Panic);
1050 store.limiter_async(|s| s as &mut dyn ResourceLimiterAsync);
1051 let instance = linker.instantiate_async(&mut store, &module).await.unwrap();
1052 let memory = instance.get_memory(&mut store, "m").unwrap();
1053
1054 // Grow the memory, which should panic
1055 memory.grow_async(&mut store, 3).await.unwrap();
1056}
1057
1058#[tokio::test]
1059#[should_panic(expected = "async resource limiter memory growing")]

Callers

nothing calls this directly

Calls 6

limiter_asyncMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45
instantiate_asyncMethod · 0.45
get_memoryMethod · 0.45
grow_asyncMethod · 0.45

Tested by

no test coverage detected