Skip to content

p3 bindgen forces async: all — no per-function sync lift, blocking call-return access to a single export #526

Description

@avrabe

Friction (from relay's P3 MC/DC work)

rust_wasm_component_bindgen(wasi_version = "p3") generates the guest wrapper with async: allevery export is lifted async, including functions whose WIT signature is plain sync (no stream/future). The generated trait method becomes async fn and the core export becomes [async-lift]...#<fn> / [task-return]<fn>.

Why it's a problem

A call-return consumer can't invoke an async-lift export. Concretely, an MC/DC harness (witness) couldn't drive relay's composed cascade for coverage, because adding a sync step(...) inside the p3 component still produced an async-lift export. We had no way to say "this one function is synchronous."

error: method should be `async` or return a future, but it is synchronous

(generated wrapper header: // async: all)

Ask

Expose a per-function async override on rust_wasm_component_bindgen (wit-bindgen supports async: { only: [...] } / an exclude list), so a component can keep its stream exports async while lifting a specific function synchronously.

Workaround (relay v1.80)

We built a separate p2 (sync) sibling component exporting the call-return function over the same shared engine library — works, but it's a whole extra component + WIT + fuse target just to expose one sync entry point. A per-function knob would remove that.

Refs: pulseengine/relay#202, pulseengine/witness#107.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions