Need help with emscripten port

I have not seen that, but the code does look wrong in the way you describe. Strange. You might submit a PR to rust-lang/rust for that.