The WasmResolver effectively exposes the raw World pointer: a client can call register with a World, stash the resulting WasmResolver somewhere, destroy the World, and then call resolve. This will cause UB with safe Rust.
Either the raw pointer needs to be protected so that it cannot be used without the World pointer becoming invalid (which is probably more complicated than simply "the World hasn't been destroyed or moved"), or those functions must be made unsafe and there must be a documented requirement that the World still exist.
The
WasmResolver
effectively exposes the rawWorld
pointer: a client can callregister
with aWorld
, stash the resultingWasmResolver
somewhere, destroy theWorld
, and then callresolve
. This will cause UB with safe Rust.Either the raw pointer needs to be protected so that it cannot be used without the
World
pointer becoming invalid (which is probably more complicated than simply "theWorld
hasn't been destroyed or moved"), or those functions must be madeunsafe
and there must be a documented requirement that theWorld
still exist.