-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize std::arch::wasm32::unreachable
#61119
Comments
@rfcbot fcp merge Seems reasonable to me to stabilize! |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Is this the same as |
It is indeed the same, but there have been concerns about stabilizing |
I guess almost all of MCUs don't have such an instruction. Maybe @japaric can confirm this? |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
Ok great! @pepyakin want to send a PR to stabilize to stdsimd? |
…hton Update stdsimd Ref rust-lang#61119, for stabilization of wasm32 `unreachable`
…hton Update stdsimd Ref rust-lang#61119, for stabilization of wasm32 `unreachable`
I think this can be closed @alexcrichton |
This is a tracking issue to stabilize
std::arch::wasm32::unreachable
The tentative signature is:
Semantics
This intrinsic represents instruction that is present in the MVP of WebAssembly:
unreachable
.From the surface it is a simple instruction: it doesn't take any arguments nor return anything. Upon the execution it generates a trap, which terminates the execution of wasm immediately returning control to the embedder with an error. There are no way to catch a trap at the moment.
Note that technically a WebAssembly instance can be used after a trap. However, Rust doesn't guarantee that such a module is usable after a trap. For example, there is no guarantee that the stack will be reset to initial values or that any destructors be executed.
Stabilization in Rust
In a way, this intrinsic is similar to the currently stabilized
std::process::abort
function. In fact,std::process::abort
is lowered to theunreachable
instruction for wasm32-unknown-unknown - this is totally makes sense since wasm32-unknown-unknown doesn't make any assumptions of the host environment. However, there is a problem withstd::process::abort
, it is only available in std. Consider how you would implement a panic handler in WebAssembly forno_std
mode when a trap is required:This works, however, it requires
#![feature(core_intrinsics)]
. Here are other ways and why they are not appropriate:loop { }
which might be a problem.call_indirect
suffer from the similar issues.Stabilization of
unreachable
will allow implementing the panic handler inno_std
environments on stable.cc @alexcrichton @sunfishcode
The text was updated successfully, but these errors were encountered: