Wasm normally doesn't have a concept of an "environment" so wasm32-unknown-unknown target just returns None
in getenv
. Relevant code:
- I think this is the function called to get an environment variable (
RUST_BACKTRACE
): https://github.com/rust-lang/rust/blob/e413d89aa706060ddc347e1e06d551ec86d3f471/library/std/src/env.rs#L235-L243 -
os_imp
is declared as this for Wasm: https://github.com/rust-lang/rust/blob/e413d89aa706060ddc347e1e06d551ec86d3f471/library/std/src/sys/wasm/mod.rs#L30-L31 - which just returns
None
: https://github.com/rust-lang/rust/blob/e413d89aa706060ddc347e1e06d551ec86d3f471/library/std/src/sys/unsupported/os.rs#L78-L80
So RUST_BACKTRACE is never enabled in wasm32-unknown-unknown builds.
I'm wondering if there's another way of enabling backtraces. Is this possible? I asked this many times in different places before and the answer was always "no", but I'm wondering if anything changed.
If the answer is still "no" then there's no way to enable Rust backtraces in wasm32-unknown-unknown builds, which is unfortunate. Does anyone know any workarounds for this? Or any hacks? I searched for open issues in Rust GH page but couldn't find anything relevant.
Thanks.