winch: Gracefully handle compilation errors #9851
Open
+1,452
−990
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #8096
This commit threads
anyhow::Result
through most of Winch's compilation process in order to gracefully handle compilation errors instead of panicking.The error classification is intentionally very granular, to avoid string allocation which could impact compilation performance.
The errors largely fit in two categories:
The firs category signals partial or no support for Wasmtime features and or Wasm proposals. These errors are meant to be temporary while such features or proposals are in development.
The second category signals that a compilation invariant was not met. These errors are considered internal and their presence usually means a bug in the compiler.