0.16.0: wasm32-emscripten fails to build because of default panic handler, recommended workaround?

For anyone who needs to compile for Emscripten using 0.16 instead of 0.17-dev, there are no simple fully functional workarounds. However, if you declare

pub const std_options_debug_io = std.Io.failing;
pub const panic = std.debug.no_panic;

in your root source file, your code should at least compile, with the caveat that most std APIs that try to write to stderr might panic (by virtue of calling the failing lockStderr() implementation, which contains an unreachable statement).

3 Likes