Skip to content

Sync with wasm-tools a bit more, clarify task.return & borrows - #737

Merged
lukewagner merged 2 commits into
WebAssembly:mainfrom
alexcrichton:minor-updates
Oct 13, 2026
Merged

lukewagner merged 2 commits into
WebAssembly:mainfrom
alexcrichton:minor-updates

Conversation

@alexcrichton

Copy link
Copy Markdown
Collaborator

This is a few more minor edits to the spec from comparing the implementation in wasm-tools against the spec. The changes here are:

  • Encoding rules for types within a core module type have been updated to statically disallow core-modules-in-core-modules. This matches wasm-tools' behavior where within a core module the funky 0x00 prefix isn't needed for GC types, it's only within components that's needed. Minor binary.wast updates were made for this.

  • The async option on canon lower no longer unconditionally requires memory. This is already tested, wasm-tools already implements this behavior, so this syncs the explainer with the tests.

  • An explicit validation rule was added to disallow borrows in the $t passed to the task.return intrinsic. This already wouldn't work anywhere because it couldn't match a function signature, but it seems reasonable to go ahead and statically disallow it here to avoid runtimes having to worry about it.

This is a few more minor edits to the spec from comparing the
implementation in wasm-tools against the spec. The changes here are:

* Encoding rules for types within a core module type have been updated
  to statically disallow core-modules-in-core-modules. This matches
  wasm-tools' behavior where within a core module the funky `0x00`
  prefix isn't needed for GC types, it's only within components that's
  needed. Minor `binary.wast` updates were made for this.

* The `async` option on `canon lower` no longer unconditionally requires
  `memory`. This is already tested, wasm-tools already implements this
  behavior, so this syncs the explainer with the tests.

* An explicit validation rule was added to disallow `borrow`s in the
  `$t` passed to the `task.return` intrinsic. This already wouldn't work
  anywhere because it couldn't match a function signature, but it seems
  reasonable to go ahead and statically disallow it here to avoid
  runtimes having to worry about it.

@lukewagner lukewagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks!

@lukewagner

Copy link
Copy Markdown
Member

Oh, one other thought: might be good to throw an assert_invalid test somewhere to capture the not-in-task.return rule.

WorldSEnder pushed a commit to WorldSEnder/wasm-tools that referenced this pull request Oct 7, 2026
@alexcrichton

Copy link
Copy Markdown
Collaborator Author

can do!

@lukewagner
lukewagner merged commit f78ac03 into WebAssembly:main Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants