alexcrichton opened PR #11319 from alexcrichton:to-raw-is-safe to bytecodealliance:main:
This commit updates Wasmtime's core
Val::to_rawfunction a safe function. This was previously marked asunsafewith documentation that the raw pointer could be invalid, but that's not a reason for the function itself to beunsafe. Usage of the returned value is stillunsafe, but simply acquiring the value is not itself an unsafe operation.This additionally marks a number of GC-related
from_rawfunctions as safe. Wasmtime's GC is safe in the face of heap corruption, so it's memory safe to pass in any 32-bit value. Documentation still indicates that panics are possible, however.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested wasmtime-core-reviewers for a review on PR #11319.
alexcrichton requested fitzgen for a review on PR #11319.
fitzgen submitted PR review.
fitzgen merged PR #11319.
Last updated: Dec 06 2025 at 07:03 UTC