Skip to content
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

use core::intrinsics::abort() in panic handler and ditch build-std option (compiles std, alloc, core) #124

Open
greenhat opened this issue Feb 8, 2024 · 1 comment · May be fixed by #135
Assignees

Comments

@greenhat
Copy link
Contributor

greenhat commented Feb 8, 2024

See the Rust -> MASM compilation example at #91 for panic handler.

Remove build-std option in CompilerTest.

@bitwalker
Copy link
Contributor

I discovered that we do not need to use core::intrinsics::abort, instead we can use core::arch::wasm32::unreachable, which has the same effect, but is stable, as opposed to core::intrinsics::abort which is perma-unstable. I've updated the guides in our documentation, but we should probably update everything else that uses unstable intrinsic (or that we held off on updating due to the instability).

For crates which need to compile for both Wasm and non-Wasm targets, we can use conditional compilation to use the wasm32 intrinsic when appropriate, but I think most everything we have that needs it, is only targeting Wasm anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants