Skip to content

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

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

Open
greenhat opened this issue Feb 8, 2024 · 3 comments · May be fixed by #135
Assignees
Labels
rust Related to the Rust SDK or frontend tooling ux User experience-related issues and tasks

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.

@greenhat greenhat self-assigned this Feb 8, 2024
@greenhat greenhat added wasm WebAssembly-related issues or features and removed wasm WebAssembly-related issues or features labels Feb 8, 2024
@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.

@bitwalker bitwalker added rust Related to the Rust SDK or frontend tooling ux User experience-related issues and tasks labels Mar 27, 2025
@bitwalker
Copy link
Contributor

@greenhat Do you recall why we haven't made this change yet? I can't remember if we ran into a specific issue, or just didn't have the time for it.

@greenhat
Copy link
Contributor Author

I tried and ran into - #135 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Related to the Rust SDK or frontend tooling ux User experience-related issues and tasks
Projects
None yet
2 participants