rustwasm / wasm-pack

📦✨ your favorite rust -> wasm workflow tool!
https://rustwasm.github.io/wasm-pack/
Apache License 2.0
6.31k stars 409 forks source link

Add panic = "unwind" causes weird compilation error #645

Closed tomaka closed 5 years ago

tomaka commented 5 years ago

🐛 Bug description

If you add the following section to your Cargo.toml:

[profile.release]
panic = "unwind"

And then you attempt to run wasm-pack build, you will get the following compilation error:

   Compiling foo v0.1.0 (/home/pierre/Projets/wasm-pack-template)
error: the crate `panic_unwind` does not have the panic strategy `unwind`

error: language item required, but not found: `eh_personality`

error: aborting due to 2 previous errors

error: Could not compile `foo`.

I reproduced this directly from https://github.com/rustwasm/wasm-pack-template/.

I'm not sure if wasm-pack overrides the panic strategy or something, but whether it is normal or not, the error is quite confusing.

🌍 Your environment

wasm-pack version: 0.8.1 rustc version: 1.34.0

jrandall commented 5 years ago

I have the same problem on the latest stable rust toolchain (1.34.2). However, the issue does not occur if I use rustup to switch to the beta toolchain (1.36.0-beta.1 (3a5d62bd5 2019-05-22)) and it also is not an issue on the latest nightly (1.36.0-nightly (37ff5d388 2019-05-22)), so it seems a fix for this may already be in place, it just hasn't made it's way to the stable release yet.

ashleygwilliams commented 5 years ago

@tomaka @jrandall are you seeing this problem still? thanks for filing!

tomaka commented 5 years ago

This is indeed fixed in the latest version of Rust (stable).