Stream: git-wasmtime

Topic: wasmtime / issue #10677 bindgen! macro does not respect `...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2025 at 20:23):

florianhartung opened issue #10677:

I am storing non-Send data inside a Store<T> in a single-threaded synchronous environment.
Also I am using the wasmtime::component::bindgen! macro to generate bindings for my WIT definition.
Updating the wasmtime dependency from 28.0.0 to 32.0.0 introduces a compilation error because a new Send bound on the store data exists for calling guest-exported functions.

I tried setting require_store_data_send: false and async: false according to the bindgen! documentation, however these seem to only have an impact on the trait bound of the generated add_to_linker_imports_get_host function.

Here is a minimal example for better understanding:

bindgen!({
    inline: "
        package my:inline;
        world my-world {
            export foo: func();
        }
    ",
    async: false,
    require_store_data_send: false,
});

expands to

impl MyWorld {
    ...
    pub fn call_foo<S: wasmtime::AsContextMut>(
        &self,
        mut store: S,
    ) -> wasmtime::Result<()>
    where
        <S as wasmtime::AsContext>::Data: Send,
    { ... }
}

Here there is a <S as wasmtime::AsContext>::Data: Send trait bound, which essentially forbids the use of non-Send store data when calling guest-exposed functions.
This restriction did not exist in v28.0.0 and I do not see a reason why it would be required now.

The change was introduced in this commit in crates/wit-bindgen/src/lib.rs line 3290 (this is the direct link, however the link does not load correctly for me atleast).

My question is: Is this indeed a bug or is there is any other option I've overlooked that allows me to use non-Send store data?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2025 at 20:28):

florianhartung commented on issue #10677:

Also I noticed that all tests in crates/component-macro/tests cover only the require_store_data_send: true case as of now.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2025 at 21:30):

florianhartung edited a comment on issue #10677:

Also I noticed that all the tests in crates/component-macro/tests currently only cover the require_store_data_send: true case.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 28 2025 at 16:10):

alexcrichton closed issue #10677:

I am storing non-Send data inside a Store<T> in a single-threaded synchronous environment.
Also I am using the wasmtime::component::bindgen! macro to generate bindings for my WIT definition.
Updating the wasmtime dependency from 28.0.0 to 32.0.0 introduces a compilation error because a new Send bound on the store data exists for calling guest-exported functions.

I tried setting require_store_data_send: false and async: false according to the bindgen! documentation, however these seem to only have an impact on the trait bound of the generated add_to_linker_imports_get_host function.

Here is a minimal example for better understanding:

bindgen!({
    inline: "
        package my:inline;
        world my-world {
            export foo: func();
        }
    ",
    async: false,
    require_store_data_send: false,
});

expands to

impl MyWorld {
    ...
    pub fn call_foo<S: wasmtime::AsContextMut>(
        &self,
        mut store: S,
    ) -> wasmtime::Result<()>
    where
        <S as wasmtime::AsContext>::Data: Send,
    { ... }
}

Here there is a <S as wasmtime::AsContext>::Data: Send trait bound, which essentially forbids the use of non-Send store data when calling guest-exposed functions.
This restriction did not exist in v28.0.0 and I do not see a reason why it would be required now.

The change was introduced in this commit in crates/wit-bindgen/src/lib.rs line 3290 (this is the direct link, however the link does not load correctly for me atleast).

My question is: Is this indeed a bug or is there is any other option I've overlooked that allows me to use non-Send store data?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 28 2025 at 16:10):

alexcrichton commented on issue #10677:

Thanks for the report! This was an accidental regression that wasn't intended. Should be fixed in https://github.com/bytecodealliance/wasmtime/pull/10685

view this post on Zulip Wasmtime GitHub notifications bot (Apr 28 2025 at 16:10):

alexcrichton reopened issue #10677:

I am storing non-Send data inside a Store<T> in a single-threaded synchronous environment.
Also I am using the wasmtime::component::bindgen! macro to generate bindings for my WIT definition.
Updating the wasmtime dependency from 28.0.0 to 32.0.0 introduces a compilation error because a new Send bound on the store data exists for calling guest-exported functions.

I tried setting require_store_data_send: false and async: false according to the bindgen! documentation, however these seem to only have an impact on the trait bound of the generated add_to_linker_imports_get_host function.

Here is a minimal example for better understanding:

bindgen!({
    inline: "
        package my:inline;
        world my-world {
            export foo: func();
        }
    ",
    async: false,
    require_store_data_send: false,
});

expands to

impl MyWorld {
    ...
    pub fn call_foo<S: wasmtime::AsContextMut>(
        &self,
        mut store: S,
    ) -> wasmtime::Result<()>
    where
        <S as wasmtime::AsContext>::Data: Send,
    { ... }
}

Here there is a <S as wasmtime::AsContext>::Data: Send trait bound, which essentially forbids the use of non-Send store data when calling guest-exposed functions.
This restriction did not exist in v28.0.0 and I do not see a reason why it would be required now.

The change was introduced in this commit in crates/wit-bindgen/src/lib.rs line 3290 (this is the direct link, however the link does not load correctly for me atleast).

My question is: Is this indeed a bug or is there is any other option I've overlooked that allows me to use non-Send store data?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 28 2025 at 16:11):

alexcrichton commented on issue #10677:

er, didn't mean to close, wrong button.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 28 2025 at 17:22):

alexcrichton closed issue #10677:

I am storing non-Send data inside a Store<T> in a single-threaded synchronous environment.
Also I am using the wasmtime::component::bindgen! macro to generate bindings for my WIT definition.
Updating the wasmtime dependency from 28.0.0 to 32.0.0 introduces a compilation error because a new Send bound on the store data exists for calling guest-exported functions.

I tried setting require_store_data_send: false and async: false according to the bindgen! documentation, however these seem to only have an impact on the trait bound of the generated add_to_linker_imports_get_host function.

Here is a minimal example for better understanding:

bindgen!({
    inline: "
        package my:inline;
        world my-world {
            export foo: func();
        }
    ",
    async: false,
    require_store_data_send: false,
});

expands to

impl MyWorld {
    ...
    pub fn call_foo<S: wasmtime::AsContextMut>(
        &self,
        mut store: S,
    ) -> wasmtime::Result<()>
    where
        <S as wasmtime::AsContext>::Data: Send,
    { ... }
}

Here there is a <S as wasmtime::AsContext>::Data: Send trait bound, which essentially forbids the use of non-Send store data when calling guest-exposed functions.
This restriction did not exist in v28.0.0 and I do not see a reason why it would be required now.

The change was introduced in this commit in crates/wit-bindgen/src/lib.rs line 3290 (this is the direct link, however the link does not load correctly for me atleast).

My question is: Is this indeed a bug or is there is any other option I've overlooked that allows me to use non-Send store data?


Last updated: Dec 06 2025 at 06:05 UTC