wasm-bindgen
wasm-bindgen copied to clipboard
Skip over unsupported instructions instead of panicking
Fixes #2969
This changes wasm-bindgen-wasm-interpreter to ignore a function rather than panicking if it contains an unsupported instruction. This works around some runtime glue that gets added to our descriptor functions on the WASI target by more-or-less ignoring them.
I also put some work into making sure a helpful error message is given if the actual describe function contains unsupported instructions, by keeping track of the instructions that caused us to skip and including them in the error message if the descriptor is invalid.
I think that the better error messages here are definitely good to have, but I would prefer to not skip over unknown functions. We can't really say ahead of time whether they'll be crucial to the execution and final result or not, so I wouldn't be comfortable automatically skipping them.
I will close this for now as it mostly addresses a WASI issue, apart from what alexcrichton said.
See #3421.