Skip to content

Replace --async with --sync - #1730

Open
Lstarsky0 wants to merge 1 commit into
bytecodealliance:mainfrom
Lstarsky0:sync-option
Open

Lstarsky0 wants to merge 1 commit into
bytecodealliance:mainfrom
Lstarsky0:sync-option

Conversation

@Lstarsky0

Copy link
Copy Markdown
Contributor

As discussed in #1622: functions that are async in WIT get async bindings, everything else gets sync bindings, and --sync is the only override. It takes the same filters --async did (all, foo:bar/baz#f, import:…, export:…), without the - prefix. Since they only go one way now, their order no longer matters. generate! takes sync: true / sync: [...] in place of async:, and async: now fails with a message pointing at sync:.

For reference, async: true on main builds fine for a world with a sync import, and then wasmtime refuses the component with "the async canonical option requires an async function type".

The --async=all codegen variant for Rust, C and MoonBit is gone. Swapping it for --sync=all passes for Rust and C, but only 3 of the 109 codegen tests have async functions, so it would mostly repeat the default run. Happy to add it if you'd like.

Ran the Rust and C codegen and runtime tests locally, plus the crate tests, clippy and rustfmt. I couldn't run Go or MoonBit end to end here; their generators only see the renamed flag, and the MoonBit direction test is updated for it.

Closes #1622
Closes #1623

Since WebAssembly/component-model#646 a function that isn't `async` in
WIT can't be lifted or lowered async, so the only override that still
makes sense is turning an `async` function back to sync. `--sync` takes
the filters `--async` took, without the `-` prefix. The `generate!`
option is renamed the same way, and `async:` now errors and points at
`sync:`.

The `--async=all` codegen test variant for Rust, C and MoonBit is
removed: it generated async imports and exports for sync functions,
which can't be put in a component.

Closes bytecodealliance#1622
Closes bytecodealliance#1623

This branch has not been deployed

No deployments
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.

Deprecate the async opt? Stop allowing async override for non-async func types

1 participant