Open
Description
Targets: wasm32-unknown-unknown
, wasm32-wasi
When calling core::arch::wasm32::unreachable()
, the generated WASM contains two unreachable
instructions instead of only one.
Example:
pub fn main(){
core::arch::wasm32::unreachable();
}
Output (from Godbolt):
example::main:
unreachable
unreachable
end_function
Godbolt link: https://rust.godbolt.org/z/Yqz6Kh9eq
This is mostly noticeable when using build-std-features=panic_immediate_abort
(which I know is unstable), as all instances of panic!()
are basically replaced with unreachable()
, and then compile down to two unreachable
instructions.
This behavior appears to have been present since core::arch::wasm32::unreachable()
was made available, so this is not a regression.