feat: P3 async components compile — wit-bindgen crate replaces stubs#423
Open
feat: P3 async components compile — wit-bindgen crate replaces stubs#423
Conversation
When wasi_version = "p3", rust_wasm_component_bindgen now passes --async to wit-bindgen, generating async-aware bindings. This is the first behavioral difference between P2 and P3 builds. Add get_p3_config() to wasm_component_utils.bzl for P3 build flags. The P3 build currently fails at compile time because the generated async code references wit_bindgen::rt::async_support, which requires the full wit-bindgen crate runtime instead of our minimal runtime stub. The P3 test is tagged manual until the async runtime is integrated. Next step: integrate wit-bindgen crate as a Rust dependency for P3 components, replacing the hand-rolled runtime wrapper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switch from minimal embedded runtime wrapper to the actual wit-bindgen crate for Rust bindings. This eliminates ~80 LOC of stubs, provides async_support for P3, and removes CLI version compatibility checks. P3 async components now fully compile: - wit-bindgen gets --async flag, crate provides async_support runtime - P3 test uses async fn greet() and passes - Bump wit-bindgen crate 0.52.0 → 0.54.0 with async feature Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The export! macro must be public for both guest and native-guest modes since we now use the wit-bindgen crate runtime for all builds. Without this, host builds fail with 'macro export is private'. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WASM (guest) builds use wit-bindgen crate runtime (supports async). Host (native-guest) builds keep embedded runtime stub (avoids linker issues with WASM-specific exports on native targets). Fixes Direct Integration Test failure where ld.gold couldn't parse version scripts from wit-bindgen crate exports on host builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
P3 async WASM components now fully compile. Two major changes:
1. Replace hand-rolled runtime stubs with wit-bindgen crate
The bindings library now depends on
@crates//:wit-bindgeninstead of our ~80 LOC hand-rolledwit_bindgen::rtmodule. This:async_supportmodule (futures, tasks, waitable sets)2. P3 async compilation pipeline works end-to-end
wasi_version = "p3"→ passes--async allto wit-bindgenasync fnmethodsasync fn greet()compiles and passesTest plan
//test/p3:p2_build_testpasses (P2 with crate runtime)//test/p3:p3_build_testpasses (P3 async — first time ever!)//examples/basic:hello_componentpasses (no regression)🤖 Generated with Claude Code