Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions crates/component-macro/src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ impl Parse for Config {
}
Opt::Stringify(val) => opts.stringify = val,
Opt::SkipMutForwardingImpls(val) => opts.skip_mut_forwarding_impls = val,
Opt::RequireStoreDataSend(val) => opts.require_store_data_send = val,
Opt::WasmtimeCrate(f) => {
opts.wasmtime_crate = Some(f.into_token_stream().to_string())
}
Expand Down Expand Up @@ -280,7 +279,6 @@ mod kw {
syn::custom_keyword!(additional_derives);
syn::custom_keyword!(stringify);
syn::custom_keyword!(skip_mut_forwarding_impls);
syn::custom_keyword!(require_store_data_send);
syn::custom_keyword!(wasmtime_crate);
syn::custom_keyword!(include_generated_code_from_file);
syn::custom_keyword!(debug);
Expand All @@ -303,7 +301,6 @@ enum Opt {
AdditionalDerives(Vec<syn::Path>),
Stringify(bool),
SkipMutForwardingImpls(bool),
RequireStoreDataSend(bool),
WasmtimeCrate(syn::Path),
IncludeGeneratedCodeFromFile(bool),
Debug(bool),
Expand Down Expand Up @@ -421,12 +418,6 @@ impl Parse for Opt {
Ok(Opt::SkipMutForwardingImpls(
input.parse::<syn::LitBool>()?.value,
))
} else if l.peek(kw::require_store_data_send) {
input.parse::<kw::require_store_data_send>()?;
input.parse::<Token![:]>()?;
Ok(Opt::RequireStoreDataSend(
input.parse::<syn::LitBool>()?.value,
))
} else if l.peek(kw::wasmtime_crate) {
input.parse::<kw::wasmtime_crate>()?;
input.parse::<Token![:]>()?;
Expand Down
16 changes: 8 additions & 8 deletions crates/component-macro/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ impl Expander for LowerExpander {
let expanded = quote! {
unsafe impl #impl_generics #wt::component::Lower for #name #ty_generics #where_clause {
#[inline]
fn linear_lower_to_flat<T>(
fn linear_lower_to_flat<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
ty: #internal::InterfaceType,
Expand All @@ -735,7 +735,7 @@ impl Expander for LowerExpander {
}

#[inline]
fn linear_lower_to_memory<T>(
fn linear_lower_to_memory<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
ty: #internal::InterfaceType,
Expand Down Expand Up @@ -821,7 +821,7 @@ impl Expander for LowerExpander {
let expanded = quote! {
unsafe impl #impl_generics #wt::component::Lower for #name #ty_generics #where_clause {
#[inline]
fn linear_lower_to_flat<T>(
fn linear_lower_to_flat<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
ty: #internal::InterfaceType,
Expand All @@ -834,7 +834,7 @@ impl Expander for LowerExpander {
}

#[inline]
fn linear_lower_to_memory<T>(
fn linear_lower_to_memory<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
ty: #internal::InterfaceType,
Expand Down Expand Up @@ -878,7 +878,7 @@ impl Expander for LowerExpander {
let expanded = quote! {
unsafe impl #wt::component::Lower for #name {
#[inline]
fn linear_lower_to_flat<T>(
fn linear_lower_to_flat<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
ty: #internal::InterfaceType,
Expand All @@ -891,7 +891,7 @@ impl Expander for LowerExpander {
}

#[inline]
fn linear_lower_to_memory<T>(
fn linear_lower_to_memory<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
ty: #internal::InterfaceType,
Expand Down Expand Up @@ -1467,7 +1467,7 @@ pub fn expand_flags(flags: &Flags) -> Result<TokenStream> {
#component_type_impl

unsafe impl #wt::component::Lower for #name {
fn linear_lower_to_flat<T>(
fn linear_lower_to_flat<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
_ty: #internal::InterfaceType,
Expand All @@ -1483,7 +1483,7 @@ pub fn expand_flags(flags: &Flags) -> Result<TokenStream> {
Ok(())
}

fn linear_lower_to_memory<T>(
fn linear_lower_to_memory<T: Send>(
&self,
cx: &mut #internal::LowerContext<'_, T>,
_ty: #internal::InterfaceType,
Expand Down
2 changes: 0 additions & 2 deletions crates/component-macro/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ mod with_and_mixing_async {
with: {
"my:inline/foo": super::with_async::my::inline::foo,
},
require_store_data_send: true,
});
}

Expand Down Expand Up @@ -656,7 +655,6 @@ mod with_and_mixing_async {
"my:inline/foo": super::with_async::my::inline::foo,
"my:inline/bar": super::without_async::my::inline::bar,
},
require_store_data_send: true,
});
}
}
Expand Down
12 changes: 6 additions & 6 deletions crates/component-macro/tests/expanded/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<T: 'static> Clone for TheWorldPre<T> {
}
}
}
impl<_T: 'static> TheWorldPre<_T> {
impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
Expand Down Expand Up @@ -111,7 +111,7 @@ const _: () = {
///
/// This method may fail if the component does not have the
/// required exports.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<Self> {
let _component = _instance_pre.component();
Expand All @@ -138,7 +138,7 @@ const _: () = {
impl TheWorld {
/// Convenience wrapper around [`TheWorldPre::new`] and
/// [`TheWorldPre::instantiate`].
pub fn instantiate<_T>(
pub fn instantiate<_T: Send>(
store: impl wasmtime::AsContextMut<Data = _T>,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
Expand Down Expand Up @@ -175,7 +175,7 @@ const _: () = {
where
D: foo::foo::chars::HostWithStore,
for<'a> D::Data<'a>: foo::foo::chars::Host,
T: 'static,
T: Send + 'static,
{
foo::foo::chars::add_to_linker::<T, D>(linker, host_getter)?;
Ok(())
Expand Down Expand Up @@ -219,7 +219,7 @@ pub mod foo {
where
D: HostWithStore,
for<'a> D::Data<'a>: Host,
T: 'static,
T: Send + 'static,
{
let mut inst = linker.instance("foo:foo/chars")?;
inst.func_wrap(
Expand Down Expand Up @@ -269,7 +269,7 @@ pub mod exports {
///
/// This constructor can be used to front-load string lookups to find exports
/// within a component.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<GuestIndices> {
let instance = _instance_pre
Expand Down
12 changes: 6 additions & 6 deletions crates/component-macro/tests/expanded/char_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<T: 'static> Clone for TheWorldPre<T> {
}
}
}
impl<_T: 'static> TheWorldPre<_T> {
impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
Expand Down Expand Up @@ -111,7 +111,7 @@ const _: () = {
///
/// This method may fail if the component does not have the
/// required exports.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<Self> {
let _component = _instance_pre.component();
Expand All @@ -138,7 +138,7 @@ const _: () = {
impl TheWorld {
/// Convenience wrapper around [`TheWorldPre::new`] and
/// [`TheWorldPre::instantiate`].
pub fn instantiate<_T>(
pub fn instantiate<_T: Send>(
store: impl wasmtime::AsContextMut<Data = _T>,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
Expand Down Expand Up @@ -175,7 +175,7 @@ const _: () = {
where
D: foo::foo::chars::HostWithStore + Send,
for<'a> D::Data<'a>: foo::foo::chars::Host + Send,
T: 'static + Send,
T: Send + 'static,
{
foo::foo::chars::add_to_linker::<T, D>(linker, host_getter)?;
Ok(())
Expand Down Expand Up @@ -229,7 +229,7 @@ pub mod foo {
where
D: HostWithStore,
for<'a> D::Data<'a>: Host,
T: 'static + Send,
T: Send + 'static,
{
let mut inst = linker.instance("foo:foo/chars")?;
inst.func_wrap_async(
Expand Down Expand Up @@ -283,7 +283,7 @@ pub mod exports {
///
/// This constructor can be used to front-load string lookups to find exports
/// within a component.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<GuestIndices> {
let instance = _instance_pre
Expand Down
16 changes: 8 additions & 8 deletions crates/component-macro/tests/expanded/char_concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<T: 'static> Clone for TheWorldPre<T> {
}
}
}
impl<_T: 'static> TheWorldPre<_T> {
impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
Expand Down Expand Up @@ -111,7 +111,7 @@ const _: () = {
///
/// This method may fail if the component does not have the
/// required exports.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<Self> {
let _component = _instance_pre.component();
Expand All @@ -138,7 +138,7 @@ const _: () = {
impl TheWorld {
/// Convenience wrapper around [`TheWorldPre::new`] and
/// [`TheWorldPre::instantiate`].
pub fn instantiate<_T>(
pub fn instantiate<_T: Send>(
store: impl wasmtime::AsContextMut<Data = _T>,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
Expand Down Expand Up @@ -175,7 +175,7 @@ const _: () = {
where
D: foo::foo::chars::HostWithStore + Send,
for<'a> D::Data<'a>: foo::foo::chars::Host + Send,
T: 'static + Send,
T: Send + 'static,
{
foo::foo::chars::add_to_linker::<T, D>(linker, host_getter)?;
Ok(())
Expand All @@ -193,12 +193,12 @@ pub mod foo {
use wasmtime::component::__internal::{anyhow, Box};
pub trait HostWithStore: wasmtime::component::HasData + Send {
/// A function that accepts a character
fn take_char<T: 'static>(
fn take_char<T: Send>(
accessor: &wasmtime::component::Accessor<T, Self>,
x: char,
) -> impl ::core::future::Future<Output = ()> + Send;
/// A function that returns a character
fn return_char<T: 'static>(
fn return_char<T: Send>(
accessor: &wasmtime::component::Accessor<T, Self>,
) -> impl ::core::future::Future<Output = char> + Send;
}
Expand All @@ -211,7 +211,7 @@ pub mod foo {
where
D: HostWithStore,
for<'a> D::Data<'a>: Host,
T: 'static + Send,
T: Send + 'static,
{
let mut inst = linker.instance("foo:foo/chars")?;
inst.func_wrap_concurrent(
Expand Down Expand Up @@ -263,7 +263,7 @@ pub mod exports {
///
/// This constructor can be used to front-load string lookups to find exports
/// within a component.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<GuestIndices> {
let instance = _instance_pre
Expand Down
12 changes: 6 additions & 6 deletions crates/component-macro/tests/expanded/char_tracing_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<T: 'static> Clone for TheWorldPre<T> {
}
}
}
impl<_T: 'static> TheWorldPre<_T> {
impl<_T: Send + 'static> TheWorldPre<_T> {
/// Creates a new copy of `TheWorldPre` bindings which can then
/// be used to instantiate into a particular store.
///
Expand Down Expand Up @@ -111,7 +111,7 @@ const _: () = {
///
/// This method may fail if the component does not have the
/// required exports.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<Self> {
let _component = _instance_pre.component();
Expand All @@ -138,7 +138,7 @@ const _: () = {
impl TheWorld {
/// Convenience wrapper around [`TheWorldPre::new`] and
/// [`TheWorldPre::instantiate`].
pub fn instantiate<_T>(
pub fn instantiate<_T: Send>(
store: impl wasmtime::AsContextMut<Data = _T>,
component: &wasmtime::component::Component,
linker: &wasmtime::component::Linker<_T>,
Expand Down Expand Up @@ -175,7 +175,7 @@ const _: () = {
where
D: foo::foo::chars::HostWithStore + Send,
for<'a> D::Data<'a>: foo::foo::chars::Host + Send,
T: 'static + Send,
T: Send + 'static,
{
foo::foo::chars::add_to_linker::<T, D>(linker, host_getter)?;
Ok(())
Expand Down Expand Up @@ -229,7 +229,7 @@ pub mod foo {
where
D: HostWithStore,
for<'a> D::Data<'a>: Host,
T: 'static + Send,
T: Send + 'static,
{
let mut inst = linker.instance("foo:foo/chars")?;
inst.func_wrap_async(
Expand Down Expand Up @@ -312,7 +312,7 @@ pub mod exports {
///
/// This constructor can be used to front-load string lookups to find exports
/// within a component.
pub fn new<_T>(
pub fn new<_T: Send>(
_instance_pre: &wasmtime::component::InstancePre<_T>,
) -> wasmtime::Result<GuestIndices> {
let instance = _instance_pre
Expand Down
Loading
Loading