Don't duplicate instruction encodings in wast - #2679
Merged
alexcrichton merged 1 commit intoSep 28, 2026
Merged
alexcrichton merged 1 commit into
alexcrichton merged 1 commit into
Conversation
This commit resolves a longstanding issue where instruction encodings in the `wasm-encoder` crate are duplicated in the `wast` crate. This dates back to where `wast` came before `wasm-encoder`, but nowadays it's just duplication that's a bit onerous to maintain. This commit refactors the macro here to be a bit wordier/un-idiomatic but delegates to `wasm_encoder::InstructionSink` for encoding all instructions. Most instructions fit in a pattern that don't need custom code, but a number of instructions are annotated with `#[custom_encode]` now to manually specify how the `wast` structures are translated to `wasm-encoder` arguments.
dicej
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit resolves a longstanding issue where instruction encodings in the
wasm-encodercrate are duplicated in thewastcrate. This dates back to wherewastcame beforewasm-encoder, but nowadays it's just duplication that's a bit onerous to maintain. This commit refactors the macro here to be a bit wordier/un-idiomatic but delegates towasm_encoder::InstructionSinkfor encoding all instructions. Most instructions fit in a pattern that don't need custom code, but a number of instructions are annotated with#[custom_encode]now to manually specify how thewaststructures are translated towasm-encoderarguments.