diff --git a/benches/call.rs b/benches/call.rs index fc296f230bb1..976d418c39cf 100644 --- a/benches/call.rs +++ b/benches/call.rs @@ -360,7 +360,7 @@ fn wasm_to_host(c: &mut Criterion) { return; } - let mut typed = Linker::new(&engine); + let mut typed = Linker::<()>::new(&engine); typed .func_wrap_async("", "nop", |caller, _: ()| { Box::new(async { diff --git a/crates/component-macro/tests/expanded/char.rs b/crates/component-macro/tests/expanded/char.rs index 446d77cc18a4..23ae9775ca88 100644 --- a/crates/component-macro/tests/expanded/char.rs +++ b/crates/component-macro/tests/expanded/char.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::chars::Host, { foo::foo::chars::add_to_linker(linker, get)?; @@ -176,6 +177,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/chars")?; @@ -205,6 +207,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/char_async.rs b/crates/component-macro/tests/expanded/char_async.rs index f38b6726a287..324d1bc60826 100644 --- a/crates/component-macro/tests/expanded/char_async.rs +++ b/crates/component-macro/tests/expanded/char_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::chars::Host + Send, { @@ -184,6 +185,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -218,6 +220,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/char_concurrent.rs b/crates/component-macro/tests/expanded/char_concurrent.rs index 3d61c1cb19a6..075dc5d83557 100644 --- a/crates/component-macro/tests/expanded/char_concurrent.rs +++ b/crates/component-macro/tests/expanded/char_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,7 +155,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::chars::Host + 'static, + T: 'static, + T: Send + foo::foo::chars::Host, U: Send + foo::foo::chars::Host, { foo::foo::chars::add_to_linker(linker, get)?; @@ -201,6 +202,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -278,6 +280,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/char_tracing_async.rs b/crates/component-macro/tests/expanded/char_tracing_async.rs index 87b23c55dd32..5d7d1a14881a 100644 --- a/crates/component-macro/tests/expanded/char_tracing_async.rs +++ b/crates/component-macro/tests/expanded/char_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::chars::Host + Send, { @@ -184,6 +185,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -247,6 +249,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/conventions.rs b/crates/component-macro/tests/expanded/conventions.rs index 21a1a1365c05..cad5a33e5fbc 100644 --- a/crates/component-macro/tests/expanded/conventions.rs +++ b/crates/component-macro/tests/expanded/conventions.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::conventions::Host, { foo::foo::conventions::add_to_linker(linker, get)?; @@ -224,6 +225,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/conventions")?; @@ -333,6 +335,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/conventions_async.rs b/crates/component-macro/tests/expanded/conventions_async.rs index f5ec669d9bb5..c4e6c851842f 100644 --- a/crates/component-macro/tests/expanded/conventions_async.rs +++ b/crates/component-macro/tests/expanded/conventions_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::conventions::Host + Send, { @@ -232,6 +233,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -366,6 +368,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/conventions_concurrent.rs b/crates/component-macro/tests/expanded/conventions_concurrent.rs index 53a6382bddee..faa0202d5257 100644 --- a/crates/component-macro/tests/expanded/conventions_concurrent.rs +++ b/crates/component-macro/tests/expanded/conventions_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::conventions::Host + 'static, + T: 'static, + T: Send + foo::foo::conventions::Host, U: Send + foo::foo::conventions::Host, { foo::foo::conventions::add_to_linker(linker, get)?; @@ -329,6 +330,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -708,6 +710,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/conventions_tracing_async.rs b/crates/component-macro/tests/expanded/conventions_tracing_async.rs index f1054fc94b37..91c64ac6a1f0 100644 --- a/crates/component-macro/tests/expanded/conventions_tracing_async.rs +++ b/crates/component-macro/tests/expanded/conventions_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::conventions::Host + Send, { @@ -232,6 +233,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -526,6 +528,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/dead-code.rs b/crates/component-macro/tests/expanded/dead-code.rs index 2b5858897f4f..9aaa2e621172 100644 --- a/crates/component-macro/tests/expanded/dead-code.rs +++ b/crates/component-macro/tests/expanded/dead-code.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Imports`] as well. -pub struct ImportsPre { +pub struct ImportsPre { instance_pre: wasmtime::component::InstancePre, indices: ImportsIndices, } -impl Clone for ImportsPre { +impl Clone for ImportsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ImportsPre { } } } -impl<_T> ImportsPre<_T> { +impl<_T: 'static> ImportsPre<_T> { /// Creates a new copy of `ImportsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: a::b::interface_with_live_type::Host + a::b::interface_with_dead_type::Host, { @@ -186,6 +187,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("a:b/interface-with-live-type")?; @@ -204,6 +206,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -274,6 +277,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("a:b/interface-with-dead-type")?; @@ -284,6 +288,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/dead-code_async.rs b/crates/component-macro/tests/expanded/dead-code_async.rs index 41c8facc53cd..906b58499c7c 100644 --- a/crates/component-macro/tests/expanded/dead-code_async.rs +++ b/crates/component-macro/tests/expanded/dead-code_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Imports`] as well. -pub struct ImportsPre { +pub struct ImportsPre { instance_pre: wasmtime::component::InstancePre, indices: ImportsIndices, } -impl Clone for ImportsPre { +impl Clone for ImportsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ImportsPre { } } } -impl<_T> ImportsPre<_T> { +impl<_T: 'static> ImportsPre<_T> { /// Creates a new copy of `ImportsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: a::b::interface_with_live_type::Host + a::b::interface_with_dead_type::Host + Send, @@ -194,6 +195,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -215,6 +217,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -287,6 +290,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -298,6 +302,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/dead-code_concurrent.rs b/crates/component-macro/tests/expanded/dead-code_concurrent.rs index 49fc51f917eb..e4947e039bb7 100644 --- a/crates/component-macro/tests/expanded/dead-code_concurrent.rs +++ b/crates/component-macro/tests/expanded/dead-code_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Imports`] as well. -pub struct ImportsPre { +pub struct ImportsPre { instance_pre: wasmtime::component::InstancePre, indices: ImportsIndices, } -impl Clone for ImportsPre { +impl Clone for ImportsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ImportsPre { } } } -impl<_T> ImportsPre<_T> { +impl<_T: 'static> ImportsPre<_T> { /// Creates a new copy of `ImportsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,8 +149,9 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send + a::b::interface_with_live_type::Host - + a::b::interface_with_dead_type::Host + 'static, + + a::b::interface_with_dead_type::Host, U: Send + a::b::interface_with_live_type::Host + a::b::interface_with_dead_type::Host, { @@ -203,6 +204,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -247,6 +249,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -328,6 +331,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -339,6 +343,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/dead-code_tracing_async.rs b/crates/component-macro/tests/expanded/dead-code_tracing_async.rs index 10ed26768b7a..fc7df1492de9 100644 --- a/crates/component-macro/tests/expanded/dead-code_tracing_async.rs +++ b/crates/component-macro/tests/expanded/dead-code_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Imports`] as well. -pub struct ImportsPre { +pub struct ImportsPre { instance_pre: wasmtime::component::InstancePre, indices: ImportsIndices, } -impl Clone for ImportsPre { +impl Clone for ImportsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ImportsPre { } } } -impl<_T> ImportsPre<_T> { +impl<_T: 'static> ImportsPre<_T> { /// Creates a new copy of `ImportsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: a::b::interface_with_live_type::Host + a::b::interface_with_dead_type::Host + Send, @@ -194,6 +195,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -228,6 +230,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -300,6 +303,7 @@ pub mod a { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -311,6 +315,7 @@ pub mod a { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/direct-import.rs b/crates/component-macro/tests/expanded/direct-import.rs index eada1387459c..37cdac572e04 100644 --- a/crates/component-macro/tests/expanded/direct-import.rs +++ b/crates/component-macro/tests/expanded/direct-import.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -146,7 +146,7 @@ const _: () = { let indices = FooIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -170,6 +170,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: FooImports, { Self::add_to_linker_imports_get_host(linker, get)?; diff --git a/crates/component-macro/tests/expanded/direct-import_async.rs b/crates/component-macro/tests/expanded/direct-import_async.rs index a096b7b322c7..1b1c0a01f503 100644 --- a/crates/component-macro/tests/expanded/direct-import_async.rs +++ b/crates/component-macro/tests/expanded/direct-import_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -153,7 +153,7 @@ const _: () = { let indices = FooIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -180,6 +180,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: FooImports + Send, { diff --git a/crates/component-macro/tests/expanded/direct-import_concurrent.rs b/crates/component-macro/tests/expanded/direct-import_concurrent.rs index e5f6b54fdd9e..fff4b35c3ba9 100644 --- a/crates/component-macro/tests/expanded/direct-import_concurrent.rs +++ b/crates/component-macro/tests/expanded/direct-import_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -171,7 +171,7 @@ const _: () = { let indices = FooIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -180,7 +180,7 @@ const _: () = { &'a mut T, Host: FooImports, >, - T: Send + 'static, + T: Send, { let mut linker = linker.root(); linker @@ -221,7 +221,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + FooImports + 'static, + T: 'static, + T: Send + FooImports, U: Send + FooImports, { Self::add_to_linker_imports_get_host(linker, get)?; diff --git a/crates/component-macro/tests/expanded/direct-import_tracing_async.rs b/crates/component-macro/tests/expanded/direct-import_tracing_async.rs index 8b9877b412e8..a4f9dd9c5163 100644 --- a/crates/component-macro/tests/expanded/direct-import_tracing_async.rs +++ b/crates/component-macro/tests/expanded/direct-import_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -153,7 +153,7 @@ const _: () = { let indices = FooIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -193,6 +193,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: FooImports + Send, { diff --git a/crates/component-macro/tests/expanded/empty.rs b/crates/component-macro/tests/expanded/empty.rs index 51705a4d8819..0163ed5a8a4e 100644 --- a/crates/component-macro/tests/expanded/empty.rs +++ b/crates/component-macro/tests/expanded/empty.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Empty`] as well. -pub struct EmptyPre { +pub struct EmptyPre { instance_pre: wasmtime::component::InstancePre, indices: EmptyIndices, } -impl Clone for EmptyPre { +impl Clone for EmptyPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for EmptyPre { } } } -impl<_T> EmptyPre<_T> { +impl<_T: 'static> EmptyPre<_T> { /// Creates a new copy of `EmptyPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/empty_async.rs b/crates/component-macro/tests/expanded/empty_async.rs index 392e9f0c130a..d86cbd390eb5 100644 --- a/crates/component-macro/tests/expanded/empty_async.rs +++ b/crates/component-macro/tests/expanded/empty_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Empty`] as well. -pub struct EmptyPre { +pub struct EmptyPre { instance_pre: wasmtime::component::InstancePre, indices: EmptyIndices, } -impl Clone for EmptyPre { +impl Clone for EmptyPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for EmptyPre { } } } -impl<_T> EmptyPre<_T> { +impl<_T: 'static> EmptyPre<_T> { /// Creates a new copy of `EmptyPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/empty_concurrent.rs b/crates/component-macro/tests/expanded/empty_concurrent.rs index 32a758e6e393..004890450fc6 100644 --- a/crates/component-macro/tests/expanded/empty_concurrent.rs +++ b/crates/component-macro/tests/expanded/empty_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Empty`] as well. -pub struct EmptyPre { +pub struct EmptyPre { instance_pre: wasmtime::component::InstancePre, indices: EmptyIndices, } -impl Clone for EmptyPre { +impl Clone for EmptyPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for EmptyPre { } } } -impl<_T> EmptyPre<_T> { +impl<_T: 'static> EmptyPre<_T> { /// Creates a new copy of `EmptyPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/empty_tracing_async.rs b/crates/component-macro/tests/expanded/empty_tracing_async.rs index 392e9f0c130a..d86cbd390eb5 100644 --- a/crates/component-macro/tests/expanded/empty_tracing_async.rs +++ b/crates/component-macro/tests/expanded/empty_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Empty`] as well. -pub struct EmptyPre { +pub struct EmptyPre { instance_pre: wasmtime::component::InstancePre, indices: EmptyIndices, } -impl Clone for EmptyPre { +impl Clone for EmptyPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for EmptyPre { } } } -impl<_T> EmptyPre<_T> { +impl<_T: 'static> EmptyPre<_T> { /// Creates a new copy of `EmptyPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/flags.rs b/crates/component-macro/tests/expanded/flags.rs index b17b4077a4b8..d8366434526e 100644 --- a/crates/component-macro/tests/expanded/flags.rs +++ b/crates/component-macro/tests/expanded/flags.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheFlags`] as well. -pub struct TheFlagsPre { +pub struct TheFlagsPre { instance_pre: wasmtime::component::InstancePre, indices: TheFlagsIndices, } -impl Clone for TheFlagsPre { +impl Clone for TheFlagsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheFlagsPre { } } } -impl<_T> TheFlagsPre<_T> { +impl<_T: 'static> TheFlagsPre<_T> { /// Creates a new copy of `TheFlagsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::flegs::Host, { foo::foo::flegs::add_to_linker(linker, get)?; @@ -293,6 +294,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/flegs")?; @@ -380,6 +382,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/flags_async.rs b/crates/component-macro/tests/expanded/flags_async.rs index 9da146f82bf5..b0412c6a9ce4 100644 --- a/crates/component-macro/tests/expanded/flags_async.rs +++ b/crates/component-macro/tests/expanded/flags_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheFlags`] as well. -pub struct TheFlagsPre { +pub struct TheFlagsPre { instance_pre: wasmtime::component::InstancePre, indices: TheFlagsIndices, } -impl Clone for TheFlagsPre { +impl Clone for TheFlagsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheFlagsPre { } } } -impl<_T> TheFlagsPre<_T> { +impl<_T: 'static> TheFlagsPre<_T> { /// Creates a new copy of `TheFlagsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::flegs::Host + Send, { @@ -301,6 +302,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -403,6 +405,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/flags_concurrent.rs b/crates/component-macro/tests/expanded/flags_concurrent.rs index 4838f2fb5d3e..c87a373d27f9 100644 --- a/crates/component-macro/tests/expanded/flags_concurrent.rs +++ b/crates/component-macro/tests/expanded/flags_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheFlags`] as well. -pub struct TheFlagsPre { +pub struct TheFlagsPre { instance_pre: wasmtime::component::InstancePre, indices: TheFlagsIndices, } -impl Clone for TheFlagsPre { +impl Clone for TheFlagsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheFlagsPre { } } } -impl<_T> TheFlagsPre<_T> { +impl<_T: 'static> TheFlagsPre<_T> { /// Creates a new copy of `TheFlagsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,7 +155,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::flegs::Host + 'static, + T: 'static, + T: Send + foo::foo::flegs::Host, U: Send + foo::foo::flegs::Host, { foo::foo::flegs::add_to_linker(linker, get)?; @@ -364,6 +365,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -609,6 +611,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/flags_tracing_async.rs b/crates/component-macro/tests/expanded/flags_tracing_async.rs index d4dbab7cd99a..57323e2c8824 100644 --- a/crates/component-macro/tests/expanded/flags_tracing_async.rs +++ b/crates/component-macro/tests/expanded/flags_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheFlags`] as well. -pub struct TheFlagsPre { +pub struct TheFlagsPre { instance_pre: wasmtime::component::InstancePre, indices: TheFlagsIndices, } -impl Clone for TheFlagsPre { +impl Clone for TheFlagsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheFlagsPre { } } } -impl<_T> TheFlagsPre<_T> { +impl<_T: 'static> TheFlagsPre<_T> { /// Creates a new copy of `TheFlagsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::flegs::Host + Send, { @@ -301,6 +302,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -515,6 +517,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/floats.rs b/crates/component-macro/tests/expanded/floats.rs index 00d2d060f307..a43ea889daa8 100644 --- a/crates/component-macro/tests/expanded/floats.rs +++ b/crates/component-macro/tests/expanded/floats.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::floats::Host, { foo::foo::floats::add_to_linker(linker, get)?; @@ -178,6 +179,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/floats")?; @@ -220,6 +222,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/floats_async.rs b/crates/component-macro/tests/expanded/floats_async.rs index 865abd6ab4b5..e155bf523c24 100644 --- a/crates/component-macro/tests/expanded/floats_async.rs +++ b/crates/component-macro/tests/expanded/floats_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::floats::Host + Send, { @@ -186,6 +187,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -237,6 +239,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/floats_concurrent.rs b/crates/component-macro/tests/expanded/floats_concurrent.rs index a1181c00cdaa..e29624368425 100644 --- a/crates/component-macro/tests/expanded/floats_concurrent.rs +++ b/crates/component-macro/tests/expanded/floats_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::floats::Host + 'static, + T: 'static, + T: Send + foo::foo::floats::Host, U: Send + foo::foo::floats::Host, { foo::foo::floats::add_to_linker(linker, get)?; @@ -220,6 +221,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -354,6 +356,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/floats_tracing_async.rs b/crates/component-macro/tests/expanded/floats_tracing_async.rs index 5a8bd590e471..b2277e5d2ddb 100644 --- a/crates/component-macro/tests/expanded/floats_tracing_async.rs +++ b/crates/component-macro/tests/expanded/floats_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::floats::Host + Send, { @@ -186,6 +187,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -295,6 +297,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/function-new.rs b/crates/component-macro/tests/expanded/function-new.rs index 1f24e5d7b908..8eb3b4e99fb8 100644 --- a/crates/component-macro/tests/expanded/function-new.rs +++ b/crates/component-macro/tests/expanded/function-new.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/function-new_async.rs b/crates/component-macro/tests/expanded/function-new_async.rs index a954ac63a861..9756b7fe8a98 100644 --- a/crates/component-macro/tests/expanded/function-new_async.rs +++ b/crates/component-macro/tests/expanded/function-new_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/function-new_concurrent.rs b/crates/component-macro/tests/expanded/function-new_concurrent.rs index 6eb4364b0ab6..0d7f16d7e447 100644 --- a/crates/component-macro/tests/expanded/function-new_concurrent.rs +++ b/crates/component-macro/tests/expanded/function-new_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/function-new_tracing_async.rs b/crates/component-macro/tests/expanded/function-new_tracing_async.rs index 08ec1ad5341f..1e6ece3e1de5 100644 --- a/crates/component-macro/tests/expanded/function-new_tracing_async.rs +++ b/crates/component-macro/tests/expanded/function-new_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/host-world.rs b/crates/component-macro/tests/expanded/host-world.rs index d4ca49b950b7..aec33d8486ae 100644 --- a/crates/component-macro/tests/expanded/host-world.rs +++ b/crates/component-macro/tests/expanded/host-world.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Host_`] as well. -pub struct Host_Pre { +pub struct Host_Pre { instance_pre: wasmtime::component::InstancePre, indices: Host_Indices, } -impl Clone for Host_Pre { +impl Clone for Host_Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Host_Pre { } } } -impl<_T> Host_Pre<_T> { +impl<_T: 'static> Host_Pre<_T> { /// Creates a new copy of `Host_Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -146,7 +146,7 @@ const _: () = { let indices = Host_Indices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -170,6 +170,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host_Imports, { Self::add_to_linker_imports_get_host(linker, get)?; diff --git a/crates/component-macro/tests/expanded/host-world_async.rs b/crates/component-macro/tests/expanded/host-world_async.rs index d36e62463345..fe8d2ff9f4ab 100644 --- a/crates/component-macro/tests/expanded/host-world_async.rs +++ b/crates/component-macro/tests/expanded/host-world_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Host_`] as well. -pub struct Host_Pre { +pub struct Host_Pre { instance_pre: wasmtime::component::InstancePre, indices: Host_Indices, } -impl Clone for Host_Pre { +impl Clone for Host_Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Host_Pre { } } } -impl<_T> Host_Pre<_T> { +impl<_T: 'static> Host_Pre<_T> { /// Creates a new copy of `Host_Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -153,7 +153,7 @@ const _: () = { let indices = Host_Indices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -180,6 +180,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: Host_Imports + Send, { diff --git a/crates/component-macro/tests/expanded/host-world_concurrent.rs b/crates/component-macro/tests/expanded/host-world_concurrent.rs index 5f45c3ad5be6..64aafda7af78 100644 --- a/crates/component-macro/tests/expanded/host-world_concurrent.rs +++ b/crates/component-macro/tests/expanded/host-world_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Host_`] as well. -pub struct Host_Pre { +pub struct Host_Pre { instance_pre: wasmtime::component::InstancePre, indices: Host_Indices, } -impl Clone for Host_Pre { +impl Clone for Host_Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Host_Pre { } } } -impl<_T> Host_Pre<_T> { +impl<_T: 'static> Host_Pre<_T> { /// Creates a new copy of `Host_Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -171,7 +171,7 @@ const _: () = { let indices = Host_Indices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -180,7 +180,7 @@ const _: () = { &'a mut T, Host: Host_Imports, >, - T: Send + 'static, + T: Send, { let mut linker = linker.root(); linker @@ -221,7 +221,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + Host_Imports + 'static, + T: 'static, + T: Send + Host_Imports, U: Send + Host_Imports, { Self::add_to_linker_imports_get_host(linker, get)?; diff --git a/crates/component-macro/tests/expanded/host-world_tracing_async.rs b/crates/component-macro/tests/expanded/host-world_tracing_async.rs index 7f83b7051df4..047aae0be6f3 100644 --- a/crates/component-macro/tests/expanded/host-world_tracing_async.rs +++ b/crates/component-macro/tests/expanded/host-world_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Host_`] as well. -pub struct Host_Pre { +pub struct Host_Pre { instance_pre: wasmtime::component::InstancePre, indices: Host_Indices, } -impl Clone for Host_Pre { +impl Clone for Host_Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Host_Pre { } } } -impl<_T> Host_Pre<_T> { +impl<_T: 'static> Host_Pre<_T> { /// Creates a new copy of `Host_Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -153,7 +153,7 @@ const _: () = { let indices = Host_Indices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -193,6 +193,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: Host_Imports + Send, { diff --git a/crates/component-macro/tests/expanded/integers.rs b/crates/component-macro/tests/expanded/integers.rs index 16500de5ef2f..34dd60f2c0a1 100644 --- a/crates/component-macro/tests/expanded/integers.rs +++ b/crates/component-macro/tests/expanded/integers.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::integers::Host, { foo::foo::integers::add_to_linker(linker, get)?; @@ -202,6 +203,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/integers")?; @@ -378,6 +380,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/integers_async.rs b/crates/component-macro/tests/expanded/integers_async.rs index eabdfea397c3..661cb2a69b28 100644 --- a/crates/component-macro/tests/expanded/integers_async.rs +++ b/crates/component-macro/tests/expanded/integers_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::integers::Host + Send, { @@ -210,6 +211,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -424,6 +426,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/integers_concurrent.rs b/crates/component-macro/tests/expanded/integers_concurrent.rs index 6a645facd34c..f69fcc5352dc 100644 --- a/crates/component-macro/tests/expanded/integers_concurrent.rs +++ b/crates/component-macro/tests/expanded/integers_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::integers::Host + 'static, + T: 'static, + T: Send + foo::foo::integers::Host, U: Send + foo::foo::integers::Host, { foo::foo::integers::add_to_linker(linker, get)?; @@ -360,6 +361,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -936,6 +938,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/integers_tracing_async.rs b/crates/component-macro/tests/expanded/integers_tracing_async.rs index 67b5f0fe65fc..e4e3d3ded9e7 100644 --- a/crates/component-macro/tests/expanded/integers_tracing_async.rs +++ b/crates/component-macro/tests/expanded/integers_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::integers::Host + Send, { @@ -210,6 +211,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -689,6 +691,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/lists.rs b/crates/component-macro/tests/expanded/lists.rs index ef2a98e9a74a..2c59d1f7f64a 100644 --- a/crates/component-macro/tests/expanded/lists.rs +++ b/crates/component-macro/tests/expanded/lists.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheLists`] as well. -pub struct TheListsPre { +pub struct TheListsPre { instance_pre: wasmtime::component::InstancePre, indices: TheListsIndices, } -impl Clone for TheListsPre { +impl Clone for TheListsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheListsPre { } } } -impl<_T> TheListsPre<_T> { +impl<_T: 'static> TheListsPre<_T> { /// Creates a new copy of `TheListsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::lists::Host, { foo::foo::lists::add_to_linker(linker, get)?; @@ -449,6 +450,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/lists")?; @@ -763,6 +765,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/lists_async.rs b/crates/component-macro/tests/expanded/lists_async.rs index d547a59fc5fa..0246562e44b8 100644 --- a/crates/component-macro/tests/expanded/lists_async.rs +++ b/crates/component-macro/tests/expanded/lists_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheLists`] as well. -pub struct TheListsPre { +pub struct TheListsPre { instance_pre: wasmtime::component::InstancePre, indices: TheListsIndices, } -impl Clone for TheListsPre { +impl Clone for TheListsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheListsPre { } } } -impl<_T> TheListsPre<_T> { +impl<_T: 'static> TheListsPre<_T> { /// Creates a new copy of `TheListsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::lists::Host + Send, { @@ -477,6 +478,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -850,6 +852,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/lists_concurrent.rs b/crates/component-macro/tests/expanded/lists_concurrent.rs index f6bdcfc16192..03f020b14e16 100644 --- a/crates/component-macro/tests/expanded/lists_concurrent.rs +++ b/crates/component-macro/tests/expanded/lists_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheLists`] as well. -pub struct TheListsPre { +pub struct TheListsPre { instance_pre: wasmtime::component::InstancePre, indices: TheListsIndices, } -impl Clone for TheListsPre { +impl Clone for TheListsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheListsPre { } } } -impl<_T> TheListsPre<_T> { +impl<_T: 'static> TheListsPre<_T> { /// Creates a new copy of `TheListsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,7 +155,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::lists::Host + 'static, + T: 'static, + T: Send + foo::foo::lists::Host, U: Send + foo::foo::lists::Host, { foo::foo::lists::add_to_linker(linker, get)?; @@ -675,6 +676,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -1723,6 +1725,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/lists_tracing_async.rs b/crates/component-macro/tests/expanded/lists_tracing_async.rs index a78204add249..209ff0099354 100644 --- a/crates/component-macro/tests/expanded/lists_tracing_async.rs +++ b/crates/component-macro/tests/expanded/lists_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheLists`] as well. -pub struct TheListsPre { +pub struct TheListsPre { instance_pre: wasmtime::component::InstancePre, indices: TheListsIndices, } -impl Clone for TheListsPre { +impl Clone for TheListsPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheListsPre { } } } -impl<_T> TheListsPre<_T> { +impl<_T: 'static> TheListsPre<_T> { /// Creates a new copy of `TheListsPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::lists::Host + Send, { @@ -477,6 +478,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1281,6 +1283,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/many-arguments.rs b/crates/component-macro/tests/expanded/many-arguments.rs index f547f86b1ade..4c238bdb6d3b 100644 --- a/crates/component-macro/tests/expanded/many-arguments.rs +++ b/crates/component-macro/tests/expanded/many-arguments.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::manyarg::Host, { foo::foo::manyarg::add_to_linker(linker, get)?; @@ -275,6 +276,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/manyarg")?; @@ -359,6 +361,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/many-arguments_async.rs b/crates/component-macro/tests/expanded/many-arguments_async.rs index 73fecdcaca18..b2f3a87db971 100644 --- a/crates/component-macro/tests/expanded/many-arguments_async.rs +++ b/crates/component-macro/tests/expanded/many-arguments_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::manyarg::Host + Send, { @@ -283,6 +284,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -373,6 +375,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/many-arguments_concurrent.rs b/crates/component-macro/tests/expanded/many-arguments_concurrent.rs index 0a8188db96c4..ba693bf2f0a3 100644 --- a/crates/component-macro/tests/expanded/many-arguments_concurrent.rs +++ b/crates/component-macro/tests/expanded/many-arguments_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::manyarg::Host + 'static, + T: 'static, + T: Send + foo::foo::manyarg::Host, U: Send + foo::foo::manyarg::Host, { foo::foo::manyarg::add_to_linker(linker, get)?; @@ -298,6 +299,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -430,6 +432,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs b/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs index ce6f62e94391..49b1711a640b 100644 --- a/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs +++ b/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::manyarg::Host + Send, { @@ -283,6 +284,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -416,6 +418,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/multiversion.rs b/crates/component-macro/tests/expanded/multiversion.rs index bb6a29a85c5f..cc24f23ee700 100644 --- a/crates/component-macro/tests/expanded/multiversion.rs +++ b/crates/component-macro/tests/expanded/multiversion.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -156,6 +156,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: my::dep0_1_0::a::Host + my::dep0_2_0::a::Host, { my::dep0_1_0::a::add_to_linker(linker, get)?; @@ -184,6 +185,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("my:dep/a@0.1.0")?; @@ -202,6 +204,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -226,6 +229,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("my:dep/a@0.2.0")?; @@ -244,6 +248,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/multiversion_async.rs b/crates/component-macro/tests/expanded/multiversion_async.rs index f1dc8b5a2e51..d65a80eeaa8d 100644 --- a/crates/component-macro/tests/expanded/multiversion_async.rs +++ b/crates/component-macro/tests/expanded/multiversion_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -162,6 +162,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: my::dep0_1_0::a::Host + my::dep0_2_0::a::Host + Send, { @@ -192,6 +193,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -213,6 +215,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -239,6 +242,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -260,6 +264,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/multiversion_concurrent.rs b/crates/component-macro/tests/expanded/multiversion_concurrent.rs index 6fb683f3ac5c..b26f35005144 100644 --- a/crates/component-macro/tests/expanded/multiversion_concurrent.rs +++ b/crates/component-macro/tests/expanded/multiversion_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -162,8 +162,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + my::dep0_1_0::a::Host + my::dep0_2_0::a::Host - + 'static, + T: 'static, + T: Send + my::dep0_1_0::a::Host + my::dep0_2_0::a::Host, U: Send + my::dep0_1_0::a::Host + my::dep0_2_0::a::Host, { my::dep0_1_0::a::add_to_linker(linker, get)?; @@ -201,6 +201,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -245,6 +246,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -289,6 +291,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -333,6 +336,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/multiversion_tracing_async.rs b/crates/component-macro/tests/expanded/multiversion_tracing_async.rs index c0b4d8382e1b..1d0e95761282 100644 --- a/crates/component-macro/tests/expanded/multiversion_tracing_async.rs +++ b/crates/component-macro/tests/expanded/multiversion_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -162,6 +162,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: my::dep0_1_0::a::Host + my::dep0_2_0::a::Host + Send, { @@ -192,6 +193,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -226,6 +228,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -252,6 +255,7 @@ pub mod my { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -286,6 +290,7 @@ pub mod my { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/path1.rs b/crates/component-macro/tests/expanded/path1.rs index 2843d61e1a7e..16aa025c1ca2 100644 --- a/crates/component-macro/tests/expanded/path1.rs +++ b/crates/component-macro/tests/expanded/path1.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path1`] as well. -pub struct Path1Pre { +pub struct Path1Pre { instance_pre: wasmtime::component::InstancePre, indices: Path1Indices, } -impl Clone for Path1Pre { +impl Clone for Path1Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path1Pre { } } } -impl<_T> Path1Pre<_T> { +impl<_T: 'static> Path1Pre<_T> { /// Creates a new copy of `Path1Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: paths::path1::test::Host, { paths::path1::test::add_to_linker(linker, get)?; @@ -162,6 +163,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("paths:path1/test")?; @@ -172,6 +174,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/path1_async.rs b/crates/component-macro/tests/expanded/path1_async.rs index 4e5c182b386f..ed817f6c2bc4 100644 --- a/crates/component-macro/tests/expanded/path1_async.rs +++ b/crates/component-macro/tests/expanded/path1_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path1`] as well. -pub struct Path1Pre { +pub struct Path1Pre { instance_pre: wasmtime::component::InstancePre, indices: Path1Indices, } -impl Clone for Path1Pre { +impl Clone for Path1Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path1Pre { } } } -impl<_T> Path1Pre<_T> { +impl<_T: 'static> Path1Pre<_T> { /// Creates a new copy of `Path1Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: paths::path1::test::Host + Send, { @@ -170,6 +171,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -181,6 +183,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/path1_concurrent.rs b/crates/component-macro/tests/expanded/path1_concurrent.rs index 318acd7e6c7a..46ec37c4680f 100644 --- a/crates/component-macro/tests/expanded/path1_concurrent.rs +++ b/crates/component-macro/tests/expanded/path1_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path1`] as well. -pub struct Path1Pre { +pub struct Path1Pre { instance_pre: wasmtime::component::InstancePre, indices: Path1Indices, } -impl Clone for Path1Pre { +impl Clone for Path1Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path1Pre { } } } -impl<_T> Path1Pre<_T> { +impl<_T: 'static> Path1Pre<_T> { /// Creates a new copy of `Path1Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,7 +149,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + paths::path1::test::Host + 'static, + T: 'static, + T: Send + paths::path1::test::Host, U: Send + paths::path1::test::Host, { paths::path1::test::add_to_linker(linker, get)?; @@ -169,6 +170,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -180,6 +182,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/path1_tracing_async.rs b/crates/component-macro/tests/expanded/path1_tracing_async.rs index 4e5c182b386f..ed817f6c2bc4 100644 --- a/crates/component-macro/tests/expanded/path1_tracing_async.rs +++ b/crates/component-macro/tests/expanded/path1_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path1`] as well. -pub struct Path1Pre { +pub struct Path1Pre { instance_pre: wasmtime::component::InstancePre, indices: Path1Indices, } -impl Clone for Path1Pre { +impl Clone for Path1Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path1Pre { } } } -impl<_T> Path1Pre<_T> { +impl<_T: 'static> Path1Pre<_T> { /// Creates a new copy of `Path1Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: paths::path1::test::Host + Send, { @@ -170,6 +171,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -181,6 +183,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/path2.rs b/crates/component-macro/tests/expanded/path2.rs index d2ef3a4716da..a1533c96b9f7 100644 --- a/crates/component-macro/tests/expanded/path2.rs +++ b/crates/component-macro/tests/expanded/path2.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path2`] as well. -pub struct Path2Pre { +pub struct Path2Pre { instance_pre: wasmtime::component::InstancePre, indices: Path2Indices, } -impl Clone for Path2Pre { +impl Clone for Path2Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path2Pre { } } } -impl<_T> Path2Pre<_T> { +impl<_T: 'static> Path2Pre<_T> { /// Creates a new copy of `Path2Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: paths::path2::test::Host, { paths::path2::test::add_to_linker(linker, get)?; @@ -162,6 +163,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("paths:path2/test")?; @@ -172,6 +174,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/path2_async.rs b/crates/component-macro/tests/expanded/path2_async.rs index f282406d5383..0658cc66ced2 100644 --- a/crates/component-macro/tests/expanded/path2_async.rs +++ b/crates/component-macro/tests/expanded/path2_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path2`] as well. -pub struct Path2Pre { +pub struct Path2Pre { instance_pre: wasmtime::component::InstancePre, indices: Path2Indices, } -impl Clone for Path2Pre { +impl Clone for Path2Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path2Pre { } } } -impl<_T> Path2Pre<_T> { +impl<_T: 'static> Path2Pre<_T> { /// Creates a new copy of `Path2Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: paths::path2::test::Host + Send, { @@ -170,6 +171,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -181,6 +183,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/path2_concurrent.rs b/crates/component-macro/tests/expanded/path2_concurrent.rs index 24b034ee7c6e..cd014b8f7084 100644 --- a/crates/component-macro/tests/expanded/path2_concurrent.rs +++ b/crates/component-macro/tests/expanded/path2_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path2`] as well. -pub struct Path2Pre { +pub struct Path2Pre { instance_pre: wasmtime::component::InstancePre, indices: Path2Indices, } -impl Clone for Path2Pre { +impl Clone for Path2Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path2Pre { } } } -impl<_T> Path2Pre<_T> { +impl<_T: 'static> Path2Pre<_T> { /// Creates a new copy of `Path2Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,7 +149,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + paths::path2::test::Host + 'static, + T: 'static, + T: Send + paths::path2::test::Host, U: Send + paths::path2::test::Host, { paths::path2::test::add_to_linker(linker, get)?; @@ -169,6 +170,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -180,6 +182,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/path2_tracing_async.rs b/crates/component-macro/tests/expanded/path2_tracing_async.rs index f282406d5383..0658cc66ced2 100644 --- a/crates/component-macro/tests/expanded/path2_tracing_async.rs +++ b/crates/component-macro/tests/expanded/path2_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Path2`] as well. -pub struct Path2Pre { +pub struct Path2Pre { instance_pre: wasmtime::component::InstancePre, indices: Path2Indices, } -impl Clone for Path2Pre { +impl Clone for Path2Pre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for Path2Pre { } } } -impl<_T> Path2Pre<_T> { +impl<_T: 'static> Path2Pre<_T> { /// Creates a new copy of `Path2Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: paths::path2::test::Host + Send, { @@ -170,6 +171,7 @@ pub mod paths { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -181,6 +183,7 @@ pub mod paths { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/records.rs b/crates/component-macro/tests/expanded/records.rs index f62f4acf57db..6e7b4bdf7531 100644 --- a/crates/component-macro/tests/expanded/records.rs +++ b/crates/component-macro/tests/expanded/records.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::records::Host, { foo::foo::records::add_to_linker(linker, get)?; @@ -340,6 +341,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/records")?; @@ -456,6 +458,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/records_async.rs b/crates/component-macro/tests/expanded/records_async.rs index 37417ba5de18..98843b9b9a98 100644 --- a/crates/component-macro/tests/expanded/records_async.rs +++ b/crates/component-macro/tests/expanded/records_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::records::Host + Send, { @@ -348,6 +349,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -487,6 +489,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/records_concurrent.rs b/crates/component-macro/tests/expanded/records_concurrent.rs index a3c77ca27e2f..a06dfb290daf 100644 --- a/crates/component-macro/tests/expanded/records_concurrent.rs +++ b/crates/component-macro/tests/expanded/records_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::records::Host + 'static, + T: 'static, + T: Send + foo::foo::records::Host, U: Send + foo::foo::records::Host, { foo::foo::records::add_to_linker(linker, get)?; @@ -442,6 +443,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -804,6 +806,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/records_tracing_async.rs b/crates/component-macro/tests/expanded/records_tracing_async.rs index 0f96214e66ff..4dc5737101d1 100644 --- a/crates/component-macro/tests/expanded/records_tracing_async.rs +++ b/crates/component-macro/tests/expanded/records_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::records::Host + Send, { @@ -348,6 +349,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -648,6 +650,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/rename.rs b/crates/component-macro/tests/expanded/rename.rs index c59880ec1e02..3c0bd3339dc2 100644 --- a/crates/component-macro/tests/expanded/rename.rs +++ b/crates/component-macro/tests/expanded/rename.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Neptune`] as well. -pub struct NeptunePre { +pub struct NeptunePre { instance_pre: wasmtime::component::InstancePre, indices: NeptuneIndices, } -impl Clone for NeptunePre { +impl Clone for NeptunePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NeptunePre { } } } -impl<_T> NeptunePre<_T> { +impl<_T: 'static> NeptunePre<_T> { /// Creates a new copy of `NeptunePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::green::Host + foo::foo::red::Host, { foo::foo::green::add_to_linker(linker, get)?; @@ -168,6 +169,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/green")?; @@ -178,6 +180,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -201,6 +204,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/red")?; @@ -219,6 +223,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/rename_async.rs b/crates/component-macro/tests/expanded/rename_async.rs index 8927ba28cd38..234682ddf5ca 100644 --- a/crates/component-macro/tests/expanded/rename_async.rs +++ b/crates/component-macro/tests/expanded/rename_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Neptune`] as well. -pub struct NeptunePre { +pub struct NeptunePre { instance_pre: wasmtime::component::InstancePre, indices: NeptuneIndices, } -impl Clone for NeptunePre { +impl Clone for NeptunePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NeptunePre { } } } -impl<_T> NeptunePre<_T> { +impl<_T: 'static> NeptunePre<_T> { /// Creates a new copy of `NeptunePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::green::Host + foo::foo::red::Host + Send, { @@ -176,6 +177,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -187,6 +189,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -212,6 +215,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -233,6 +237,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/rename_concurrent.rs b/crates/component-macro/tests/expanded/rename_concurrent.rs index ec016c971934..7873bb818510 100644 --- a/crates/component-macro/tests/expanded/rename_concurrent.rs +++ b/crates/component-macro/tests/expanded/rename_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Neptune`] as well. -pub struct NeptunePre { +pub struct NeptunePre { instance_pre: wasmtime::component::InstancePre, indices: NeptuneIndices, } -impl Clone for NeptunePre { +impl Clone for NeptunePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NeptunePre { } } } -impl<_T> NeptunePre<_T> { +impl<_T: 'static> NeptunePre<_T> { /// Creates a new copy of `NeptunePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,7 +149,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::green::Host + foo::foo::red::Host + 'static, + T: 'static, + T: Send + foo::foo::green::Host + foo::foo::red::Host, U: Send + foo::foo::green::Host + foo::foo::red::Host, { foo::foo::green::add_to_linker(linker, get)?; @@ -175,6 +176,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -186,6 +188,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -219,6 +222,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -263,6 +267,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/rename_tracing_async.rs b/crates/component-macro/tests/expanded/rename_tracing_async.rs index 899cdc4115ba..99a927718aac 100644 --- a/crates/component-macro/tests/expanded/rename_tracing_async.rs +++ b/crates/component-macro/tests/expanded/rename_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Neptune`] as well. -pub struct NeptunePre { +pub struct NeptunePre { instance_pre: wasmtime::component::InstancePre, indices: NeptuneIndices, } -impl Clone for NeptunePre { +impl Clone for NeptunePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NeptunePre { } } } -impl<_T> NeptunePre<_T> { +impl<_T: 'static> NeptunePre<_T> { /// Creates a new copy of `NeptunePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::green::Host + foo::foo::red::Host + Send, { @@ -176,6 +177,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -187,6 +189,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -212,6 +215,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -246,6 +250,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/resources-export.rs b/crates/component-macro/tests/expanded/resources-export.rs index 428576739e8a..5988e800b313 100644 --- a/crates/component-macro/tests/expanded/resources-export.rs +++ b/crates/component-macro/tests/expanded/resources-export.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`W`] as well. -pub struct WPre { +pub struct WPre { instance_pre: wasmtime::component::InstancePre, indices: WIndices, } -impl Clone for WPre { +impl Clone for WPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WPre { } } } -impl<_T> WPre<_T> { +impl<_T: 'static> WPre<_T> { /// Creates a new copy of `WPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -179,6 +179,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::transitive_import::Host, { foo::foo::transitive_import::add_to_linker(linker, get)?; @@ -231,6 +232,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/transitive-import")?; @@ -251,6 +253,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/resources-export_async.rs b/crates/component-macro/tests/expanded/resources-export_async.rs index a253e84d317a..3b5652bda6e1 100644 --- a/crates/component-macro/tests/expanded/resources-export_async.rs +++ b/crates/component-macro/tests/expanded/resources-export_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`W`] as well. -pub struct WPre { +pub struct WPre { instance_pre: wasmtime::component::InstancePre, indices: WIndices, } -impl Clone for WPre { +impl Clone for WPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WPre { } } } -impl<_T> WPre<_T> { +impl<_T: 'static> WPre<_T> { /// Creates a new copy of `WPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -185,6 +185,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::transitive_import::Host + Send, { @@ -240,6 +241,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -264,6 +266,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/resources-export_concurrent.rs b/crates/component-macro/tests/expanded/resources-export_concurrent.rs index 91334db1f9a8..1be05e0d39d0 100644 --- a/crates/component-macro/tests/expanded/resources-export_concurrent.rs +++ b/crates/component-macro/tests/expanded/resources-export_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`W`] as well. -pub struct WPre { +pub struct WPre { instance_pre: wasmtime::component::InstancePre, indices: WIndices, } -impl Clone for WPre { +impl Clone for WPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WPre { } } } -impl<_T> WPre<_T> { +impl<_T: 'static> WPre<_T> { /// Creates a new copy of `WPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -185,7 +185,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::transitive_import::Host + 'static, + T: 'static, + T: Send + foo::foo::transitive_import::Host, U: Send + foo::foo::transitive_import::Host, { foo::foo::transitive_import::add_to_linker(linker, get)?; @@ -238,6 +239,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -259,6 +261,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/resources-export_tracing_async.rs b/crates/component-macro/tests/expanded/resources-export_tracing_async.rs index a8ec2c60cacb..e98578c26455 100644 --- a/crates/component-macro/tests/expanded/resources-export_tracing_async.rs +++ b/crates/component-macro/tests/expanded/resources-export_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`W`] as well. -pub struct WPre { +pub struct WPre { instance_pre: wasmtime::component::InstancePre, indices: WIndices, } -impl Clone for WPre { +impl Clone for WPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WPre { } } } -impl<_T> WPre<_T> { +impl<_T: 'static> WPre<_T> { /// Creates a new copy of `WPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -185,6 +185,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::transitive_import::Host + Send, { @@ -240,6 +241,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -264,6 +266,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/resources-import.rs b/crates/component-macro/tests/expanded/resources-import.rs index f2aab9e389d1..f467e1284293 100644 --- a/crates/component-macro/tests/expanded/resources-import.rs +++ b/crates/component-macro/tests/expanded/resources-import.rs @@ -33,11 +33,11 @@ impl<_T: HostWorldResource + ?Sized> HostWorldResource for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -45,7 +45,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -222,7 +222,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -287,6 +287,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::resources::Host + foo::foo::long_use_chain1::Host + foo::foo::long_use_chain2::Host + foo::foo::long_use_chain3::Host + foo::foo::long_use_chain4::Host @@ -478,6 +479,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/resources")?; @@ -728,6 +730,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -856,6 +859,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/long-use-chain1")?; @@ -876,6 +880,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -893,6 +898,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/long-use-chain2")?; @@ -903,6 +909,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -920,6 +927,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/long-use-chain3")?; @@ -930,6 +938,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -949,6 +958,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/long-use-chain4")?; @@ -967,6 +977,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -1002,6 +1013,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker @@ -1023,6 +1035,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/resources-import_async.rs b/crates/component-macro/tests/expanded/resources-import_async.rs index 40969bcab6d9..01032e9daa85 100644 --- a/crates/component-macro/tests/expanded/resources-import_async.rs +++ b/crates/component-macro/tests/expanded/resources-import_async.rs @@ -34,11 +34,11 @@ impl<_T: HostWorldResource + ?Sized + Send> HostWorldResource for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -46,7 +46,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -230,7 +230,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -307,6 +307,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::resources::Host + foo::foo::long_use_chain1::Host + foo::foo::long_use_chain2::Host + foo::foo::long_use_chain3::Host @@ -513,6 +514,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -811,6 +813,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -947,6 +950,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -971,6 +975,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -990,6 +995,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1001,6 +1007,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1020,6 +1027,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1031,6 +1039,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1052,6 +1061,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1073,6 +1083,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1111,6 +1122,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1136,6 +1148,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/resources-import_concurrent.rs b/crates/component-macro/tests/expanded/resources-import_concurrent.rs index 0218bab35354..bc06409ef076 100644 --- a/crates/component-macro/tests/expanded/resources-import_concurrent.rs +++ b/crates/component-macro/tests/expanded/resources-import_concurrent.rs @@ -88,11 +88,11 @@ impl<_T: HostWorldResource> HostWorldResource for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -100,7 +100,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -302,7 +302,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -311,7 +311,7 @@ const _: () = { &'a mut T, Host: TheWorldImports, >, - T: Send + 'static, + T: Send, { let mut linker = linker.root(); linker @@ -467,12 +467,13 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send + foo::foo::resources::Host + foo::foo::long_use_chain1::Host + foo::foo::long_use_chain2::Host + foo::foo::long_use_chain3::Host + foo::foo::long_use_chain4::Host + foo::foo::transitive_interface_with_resource::Host - + TheWorldImports + 'static, + + TheWorldImports, U: Send + foo::foo::resources::Host + foo::foo::long_use_chain1::Host + foo::foo::long_use_chain2::Host + foo::foo::long_use_chain3::Host @@ -863,6 +864,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -1633,6 +1635,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -1922,6 +1925,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -1943,6 +1947,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -1961,6 +1966,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -1972,6 +1978,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -1990,6 +1997,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -2001,6 +2009,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -2030,6 +2039,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -2078,6 +2088,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -2124,6 +2135,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -2146,6 +2158,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/resources-import_tracing_async.rs b/crates/component-macro/tests/expanded/resources-import_tracing_async.rs index 251742886b1c..60259c4c597b 100644 --- a/crates/component-macro/tests/expanded/resources-import_tracing_async.rs +++ b/crates/component-macro/tests/expanded/resources-import_tracing_async.rs @@ -34,11 +34,11 @@ impl<_T: HostWorldResource + ?Sized + Send> HostWorldResource for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -46,7 +46,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -230,7 +230,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, host_getter: G, ) -> wasmtime::Result<()> @@ -362,6 +362,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::resources::Host + foo::foo::long_use_chain1::Host + foo::foo::long_use_chain2::Host + foo::foo::long_use_chain3::Host @@ -576,6 +577,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1202,6 +1204,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1338,6 +1341,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1362,6 +1366,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1381,6 +1386,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1392,6 +1398,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1411,6 +1418,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1422,6 +1430,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1443,6 +1452,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1477,6 +1487,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -1515,6 +1526,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1540,6 +1552,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/share-types.rs b/crates/component-macro/tests/expanded/share-types.rs index a01bb59ca43c..d19cb549aac8 100644 --- a/crates/component-macro/tests/expanded/share-types.rs +++ b/crates/component-macro/tests/expanded/share-types.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`HttpInterface`] as well. -pub struct HttpInterfacePre { +pub struct HttpInterfacePre { instance_pre: wasmtime::component::InstancePre, indices: HttpInterfaceIndices, } -impl Clone for HttpInterfacePre { +impl Clone for HttpInterfacePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for HttpInterfacePre { } } } -impl<_T> HttpInterfacePre<_T> { +impl<_T: 'static> HttpInterfacePre<_T> { /// Creates a new copy of `HttpInterfacePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::http_types::Host + http_fetch::Host, { foo::foo::http_types::add_to_linker(linker, get)?; @@ -210,6 +211,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/http-types")?; @@ -220,6 +222,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -250,6 +253,7 @@ pub mod http_fetch { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("http-fetch")?; @@ -268,6 +272,7 @@ pub mod http_fetch { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/share-types_async.rs b/crates/component-macro/tests/expanded/share-types_async.rs index d03755de280f..a81290880be0 100644 --- a/crates/component-macro/tests/expanded/share-types_async.rs +++ b/crates/component-macro/tests/expanded/share-types_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`HttpInterface`] as well. -pub struct HttpInterfacePre { +pub struct HttpInterfacePre { instance_pre: wasmtime::component::InstancePre, indices: HttpInterfaceIndices, } -impl Clone for HttpInterfacePre { +impl Clone for HttpInterfacePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for HttpInterfacePre { } } } -impl<_T> HttpInterfacePre<_T> { +impl<_T: 'static> HttpInterfacePre<_T> { /// Creates a new copy of `HttpInterfacePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::http_types::Host + http_fetch::Host + Send, { @@ -218,6 +219,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -229,6 +231,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -261,6 +264,7 @@ pub mod http_fetch { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -282,6 +286,7 @@ pub mod http_fetch { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/share-types_concurrent.rs b/crates/component-macro/tests/expanded/share-types_concurrent.rs index 6d6b1b7153d6..ea067bf6ec90 100644 --- a/crates/component-macro/tests/expanded/share-types_concurrent.rs +++ b/crates/component-macro/tests/expanded/share-types_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`HttpInterface`] as well. -pub struct HttpInterfacePre { +pub struct HttpInterfacePre { instance_pre: wasmtime::component::InstancePre, indices: HttpInterfaceIndices, } -impl Clone for HttpInterfacePre { +impl Clone for HttpInterfacePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for HttpInterfacePre { } } } -impl<_T> HttpInterfacePre<_T> { +impl<_T: 'static> HttpInterfacePre<_T> { /// Creates a new copy of `HttpInterfacePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,7 +155,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::http_types::Host + http_fetch::Host + 'static, + T: 'static, + T: Send + foo::foo::http_types::Host + http_fetch::Host, U: Send + foo::foo::http_types::Host + http_fetch::Host, { foo::foo::http_types::add_to_linker(linker, get)?; @@ -217,6 +218,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -228,6 +230,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -269,6 +272,7 @@ pub mod http_fetch { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -310,6 +314,7 @@ pub mod http_fetch { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/share-types_tracing_async.rs b/crates/component-macro/tests/expanded/share-types_tracing_async.rs index fd029c31add5..88034bd9de10 100644 --- a/crates/component-macro/tests/expanded/share-types_tracing_async.rs +++ b/crates/component-macro/tests/expanded/share-types_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`HttpInterface`] as well. -pub struct HttpInterfacePre { +pub struct HttpInterfacePre { instance_pre: wasmtime::component::InstancePre, indices: HttpInterfaceIndices, } -impl Clone for HttpInterfacePre { +impl Clone for HttpInterfacePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for HttpInterfacePre { } } } -impl<_T> HttpInterfacePre<_T> { +impl<_T: 'static> HttpInterfacePre<_T> { /// Creates a new copy of `HttpInterfacePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::http_types::Host + http_fetch::Host + Send, { @@ -218,6 +219,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -229,6 +231,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -261,6 +264,7 @@ pub mod http_fetch { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -298,6 +302,7 @@ pub mod http_fetch { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/simple-functions.rs b/crates/component-macro/tests/expanded/simple-functions.rs index 6c7327e3a2eb..3bd1c33a24c1 100644 --- a/crates/component-macro/tests/expanded/simple-functions.rs +++ b/crates/component-macro/tests/expanded/simple-functions.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::simple::Host, { foo::foo::simple::add_to_linker(linker, get)?; @@ -180,6 +181,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/simple")?; @@ -244,6 +246,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/simple-functions_async.rs b/crates/component-macro/tests/expanded/simple-functions_async.rs index fcc277ee03b8..f52360398d20 100644 --- a/crates/component-macro/tests/expanded/simple-functions_async.rs +++ b/crates/component-macro/tests/expanded/simple-functions_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::simple::Host + Send, { @@ -188,6 +189,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -265,6 +267,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/simple-functions_concurrent.rs b/crates/component-macro/tests/expanded/simple-functions_concurrent.rs index f0464bf6e509..8caec199d896 100644 --- a/crates/component-macro/tests/expanded/simple-functions_concurrent.rs +++ b/crates/component-macro/tests/expanded/simple-functions_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::simple::Host + 'static, + T: 'static, + T: Send + foo::foo::simple::Host, U: Send + foo::foo::simple::Host, { foo::foo::simple::add_to_linker(linker, get)?; @@ -242,6 +243,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -442,6 +444,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs b/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs index 209eb18682e4..b1c716d6303f 100644 --- a/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs +++ b/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::simple::Host + Send, { @@ -188,6 +189,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -353,6 +355,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/simple-lists.rs b/crates/component-macro/tests/expanded/simple-lists.rs index cf4e0ef4cd43..ad026602850f 100644 --- a/crates/component-macro/tests/expanded/simple-lists.rs +++ b/crates/component-macro/tests/expanded/simple-lists.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::simple_lists::Host, { foo::foo::simple_lists::add_to_linker(linker, get)?; @@ -195,6 +196,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/simple-lists")?; @@ -258,6 +260,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/simple-lists_async.rs b/crates/component-macro/tests/expanded/simple-lists_async.rs index 982af94ebb7f..a93e802a6692 100644 --- a/crates/component-macro/tests/expanded/simple-lists_async.rs +++ b/crates/component-macro/tests/expanded/simple-lists_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::simple_lists::Host + Send, { @@ -205,6 +206,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -277,6 +279,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/simple-lists_concurrent.rs b/crates/component-macro/tests/expanded/simple-lists_concurrent.rs index fe5dba789dfc..75d318393455 100644 --- a/crates/component-macro/tests/expanded/simple-lists_concurrent.rs +++ b/crates/component-macro/tests/expanded/simple-lists_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::simple_lists::Host + 'static, + T: 'static, + T: Send + foo::foo::simple_lists::Host, U: Send + foo::foo::simple_lists::Host, { foo::foo::simple_lists::add_to_linker(linker, get)?; @@ -231,6 +232,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -416,6 +418,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs b/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs index e24da20c6743..bb6a18caf2a2 100644 --- a/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs +++ b/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::simple_lists::Host + Send, { @@ -205,6 +206,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -338,6 +340,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/simple-wasi.rs b/crates/component-macro/tests/expanded/simple-wasi.rs index ca8d765404e3..831d8c1ca9d7 100644 --- a/crates/component-macro/tests/expanded/simple-wasi.rs +++ b/crates/component-macro/tests/expanded/simple-wasi.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Wasi`] as well. -pub struct WasiPre { +pub struct WasiPre { instance_pre: wasmtime::component::InstancePre, indices: WasiIndices, } -impl Clone for WasiPre { +impl Clone for WasiPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WasiPre { } } } -impl<_T> WasiPre<_T> { +impl<_T: 'static> WasiPre<_T> { /// Creates a new copy of `WasiPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::wasi_filesystem::Host + foo::foo::wall_clock::Host, { foo::foo::wasi_filesystem::add_to_linker(linker, get)?; @@ -227,6 +228,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/wasi-filesystem")?; @@ -253,6 +255,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -295,6 +298,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/wall-clock")?; @@ -305,6 +309,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/simple-wasi_async.rs b/crates/component-macro/tests/expanded/simple-wasi_async.rs index 25b14700b1b4..b7af18742d8a 100644 --- a/crates/component-macro/tests/expanded/simple-wasi_async.rs +++ b/crates/component-macro/tests/expanded/simple-wasi_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Wasi`] as well. -pub struct WasiPre { +pub struct WasiPre { instance_pre: wasmtime::component::InstancePre, indices: WasiIndices, } -impl Clone for WasiPre { +impl Clone for WasiPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WasiPre { } } } -impl<_T> WasiPre<_T> { +impl<_T: 'static> WasiPre<_T> { /// Creates a new copy of `WasiPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::wasi_filesystem::Host + foo::foo::wall_clock::Host + Send, { @@ -235,6 +236,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -266,6 +268,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -310,6 +313,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -321,6 +325,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs b/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs index 57f8dee304c7..2c157f16987d 100644 --- a/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs +++ b/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Wasi`] as well. -pub struct WasiPre { +pub struct WasiPre { instance_pre: wasmtime::component::InstancePre, indices: WasiIndices, } -impl Clone for WasiPre { +impl Clone for WasiPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WasiPre { } } } -impl<_T> WasiPre<_T> { +impl<_T: 'static> WasiPre<_T> { /// Creates a new copy of `WasiPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,8 +149,9 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send + foo::foo::wasi_filesystem::Host - + foo::foo::wall_clock::Host + 'static, + + foo::foo::wall_clock::Host, U: Send + foo::foo::wasi_filesystem::Host + foo::foo::wall_clock::Host, { @@ -253,6 +254,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -331,6 +333,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -393,6 +396,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -404,6 +408,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs b/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs index a5e6d6d3c5ad..c5782ec0a1ad 100644 --- a/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs +++ b/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Wasi`] as well. -pub struct WasiPre { +pub struct WasiPre { instance_pre: wasmtime::component::InstancePre, indices: WasiIndices, } -impl Clone for WasiPre { +impl Clone for WasiPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for WasiPre { } } } -impl<_T> WasiPre<_T> { +impl<_T: 'static> WasiPre<_T> { /// Creates a new copy of `WasiPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::wasi_filesystem::Host + foo::foo::wall_clock::Host + Send, { @@ -235,6 +236,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -292,6 +294,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -336,6 +339,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -347,6 +351,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/small-anonymous.rs b/crates/component-macro/tests/expanded/small-anonymous.rs index 6eee6fc2538b..4f0bbbea24f9 100644 --- a/crates/component-macro/tests/expanded/small-anonymous.rs +++ b/crates/component-macro/tests/expanded/small-anonymous.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::anon::Host, { foo::foo::anon::add_to_linker(linker, get)?; @@ -220,6 +221,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/anon")?; @@ -238,6 +240,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/small-anonymous_async.rs b/crates/component-macro/tests/expanded/small-anonymous_async.rs index fb4c743d6561..f36c96736d62 100644 --- a/crates/component-macro/tests/expanded/small-anonymous_async.rs +++ b/crates/component-macro/tests/expanded/small-anonymous_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::anon::Host + Send, { @@ -228,6 +229,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -249,6 +251,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs b/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs index 5cd6e5a05e00..6e2bb57da44c 100644 --- a/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs +++ b/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,7 +155,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::anon::Host + 'static, + T: 'static, + T: Send + foo::foo::anon::Host, U: Send + foo::foo::anon::Host, { foo::foo::anon::add_to_linker(linker, get)?; @@ -237,6 +238,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -295,6 +297,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs b/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs index 5475cd7563eb..fbfca9076135 100644 --- a/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs +++ b/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -155,6 +155,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::anon::Host + Send, { @@ -228,6 +229,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -262,6 +264,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/smoke-default.rs b/crates/component-macro/tests/expanded/smoke-default.rs index 3e7bf72fff74..d12082f454f7 100644 --- a/crates/component-macro/tests/expanded/smoke-default.rs +++ b/crates/component-macro/tests/expanded/smoke-default.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke-default_async.rs b/crates/component-macro/tests/expanded/smoke-default_async.rs index eeef13c512f0..d3e2c1122a8c 100644 --- a/crates/component-macro/tests/expanded/smoke-default_async.rs +++ b/crates/component-macro/tests/expanded/smoke-default_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke-default_concurrent.rs b/crates/component-macro/tests/expanded/smoke-default_concurrent.rs index ed9fdb7e9752..a923abb5c839 100644 --- a/crates/component-macro/tests/expanded/smoke-default_concurrent.rs +++ b/crates/component-macro/tests/expanded/smoke-default_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs b/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs index 59adb46dcfd9..4751b4aa669b 100644 --- a/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs +++ b/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke-export.rs b/crates/component-macro/tests/expanded/smoke-export.rs index 4325a63d0969..ea8e7e959b66 100644 --- a/crates/component-macro/tests/expanded/smoke-export.rs +++ b/crates/component-macro/tests/expanded/smoke-export.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke-export_async.rs b/crates/component-macro/tests/expanded/smoke-export_async.rs index 2abe17cafa45..037a5db23076 100644 --- a/crates/component-macro/tests/expanded/smoke-export_async.rs +++ b/crates/component-macro/tests/expanded/smoke-export_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke-export_concurrent.rs b/crates/component-macro/tests/expanded/smoke-export_concurrent.rs index c4928b427308..753f3540583f 100644 --- a/crates/component-macro/tests/expanded/smoke-export_concurrent.rs +++ b/crates/component-macro/tests/expanded/smoke-export_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs b/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs index 8d2475dd97b0..32d33fc4ff3e 100644 --- a/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs +++ b/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/smoke.rs b/crates/component-macro/tests/expanded/smoke.rs index 6d33cb442a3e..68aef4053bf9 100644 --- a/crates/component-macro/tests/expanded/smoke.rs +++ b/crates/component-macro/tests/expanded/smoke.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: imports::Host, { imports::add_to_linker(linker, get)?; @@ -162,6 +163,7 @@ pub mod imports { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("imports")?; @@ -180,6 +182,7 @@ pub mod imports { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/smoke_async.rs b/crates/component-macro/tests/expanded/smoke_async.rs index aa3e2342112c..ef1531dd4914 100644 --- a/crates/component-macro/tests/expanded/smoke_async.rs +++ b/crates/component-macro/tests/expanded/smoke_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: imports::Host + Send, { @@ -170,6 +171,7 @@ pub mod imports { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -191,6 +193,7 @@ pub mod imports { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/smoke_concurrent.rs b/crates/component-macro/tests/expanded/smoke_concurrent.rs index 5606c1855a5b..d59fc8a73262 100644 --- a/crates/component-macro/tests/expanded/smoke_concurrent.rs +++ b/crates/component-macro/tests/expanded/smoke_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,7 +149,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + imports::Host + 'static, + T: 'static, + T: Send + imports::Host, U: Send + imports::Host, { imports::add_to_linker(linker, get)?; @@ -178,6 +179,7 @@ pub mod imports { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -219,6 +221,7 @@ pub mod imports { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/smoke_tracing_async.rs b/crates/component-macro/tests/expanded/smoke_tracing_async.rs index fe192f4cc8cc..5b7ca7f75ab4 100644 --- a/crates/component-macro/tests/expanded/smoke_tracing_async.rs +++ b/crates/component-macro/tests/expanded/smoke_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: imports::Host + Send, { @@ -170,6 +171,7 @@ pub mod imports { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -204,6 +206,7 @@ pub mod imports { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/strings.rs b/crates/component-macro/tests/expanded/strings.rs index 3e7b9c183c17..d6e055e59a6f 100644 --- a/crates/component-macro/tests/expanded/strings.rs +++ b/crates/component-macro/tests/expanded/strings.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::strings::Host, { foo::foo::strings::add_to_linker(linker, get)?; @@ -181,6 +182,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/strings")?; @@ -227,6 +229,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/strings_async.rs b/crates/component-macro/tests/expanded/strings_async.rs index 89a4a9fc28c0..9df9afc692f7 100644 --- a/crates/component-macro/tests/expanded/strings_async.rs +++ b/crates/component-macro/tests/expanded/strings_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::strings::Host + Send, { @@ -189,6 +190,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -242,6 +244,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/strings_concurrent.rs b/crates/component-macro/tests/expanded/strings_concurrent.rs index c59efa40ba5f..822ef68beeb3 100644 --- a/crates/component-macro/tests/expanded/strings_concurrent.rs +++ b/crates/component-macro/tests/expanded/strings_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::strings::Host + 'static, + T: 'static, + T: Send + foo::foo::strings::Host, U: Send + foo::foo::strings::Host, { foo::foo::strings::add_to_linker(linker, get)?; @@ -212,6 +213,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -336,6 +338,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/strings_tracing_async.rs b/crates/component-macro/tests/expanded/strings_tracing_async.rs index b3fe620a9244..bb4f71cb622a 100644 --- a/crates/component-macro/tests/expanded/strings_tracing_async.rs +++ b/crates/component-macro/tests/expanded/strings_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::strings::Host + Send, { @@ -189,6 +190,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -287,6 +289,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/unstable-features.rs b/crates/component-macro/tests/expanded/unstable-features.rs index 36630f2e5d11..7389e25ce2c5 100644 --- a/crates/component-macro/tests/expanded/unstable-features.rs +++ b/crates/component-macro/tests/expanded/unstable-features.rs @@ -99,11 +99,11 @@ impl<_T: HostBaz + ?Sized> HostBaz for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -111,7 +111,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -239,7 +239,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, options: &LinkOptions, host_getter: G, @@ -296,6 +296,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::the_interface::Host + TheWorldImports, { if options.experimental_world { @@ -385,6 +386,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { if options.experimental_interface { @@ -433,6 +435,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, options, get) diff --git a/crates/component-macro/tests/expanded/unstable-features_async.rs b/crates/component-macro/tests/expanded/unstable-features_async.rs index d2347d55a495..12a7e62461be 100644 --- a/crates/component-macro/tests/expanded/unstable-features_async.rs +++ b/crates/component-macro/tests/expanded/unstable-features_async.rs @@ -106,11 +106,11 @@ impl<_T: HostBaz + ?Sized + Send> HostBaz for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -118,7 +118,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -253,7 +253,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, options: &LinkOptions, host_getter: G, @@ -318,6 +318,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::the_interface::Host + TheWorldImports + Send, { @@ -413,6 +414,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -469,6 +471,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/unstable-features_concurrent.rs b/crates/component-macro/tests/expanded/unstable-features_concurrent.rs index 9891ce93858a..51a1f8f54be0 100644 --- a/crates/component-macro/tests/expanded/unstable-features_concurrent.rs +++ b/crates/component-macro/tests/expanded/unstable-features_concurrent.rs @@ -120,11 +120,11 @@ impl<_T: HostBaz> HostBaz for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -132,7 +132,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -285,7 +285,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, options: &LinkOptions, host_getter: G, @@ -295,7 +295,7 @@ const _: () = { &'a mut T, Host: TheWorldImports, >, - T: Send + 'static, + T: Send, { let mut linker = linker.root(); if options.experimental_world { @@ -394,8 +394,9 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send + foo::foo::the_interface::Host - + TheWorldImports + 'static, + + TheWorldImports, U: Send + foo::foo::the_interface::Host + TheWorldImports, { @@ -516,6 +517,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -616,6 +618,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs b/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs index 8152b24b92eb..8b2031aa7322 100644 --- a/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs +++ b/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs @@ -106,11 +106,11 @@ impl<_T: HostBaz + ?Sized + Send> HostBaz for &mut _T { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`TheWorld`] as well. -pub struct TheWorldPre { +pub struct TheWorldPre { instance_pre: wasmtime::component::InstancePre, indices: TheWorldIndices, } -impl Clone for TheWorldPre { +impl Clone for TheWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -118,7 +118,7 @@ impl Clone for TheWorldPre { } } } -impl<_T> TheWorldPre<_T> { +impl<_T: 'static> TheWorldPre<_T> { /// Creates a new copy of `TheWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -253,7 +253,7 @@ const _: () = { let indices = TheWorldIndices::new(&instance.instance_pre(&store))?; indices.load(&mut store, instance) } - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut wasmtime::component::Linker, options: &LinkOptions, host_getter: G, @@ -347,6 +347,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::the_interface::Host + TheWorldImports + Send, { @@ -442,6 +443,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -527,6 +529,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/unversioned-foo.rs b/crates/component-macro/tests/expanded/unversioned-foo.rs index 58042b04a458..c216de5863ed 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Nope`] as well. -pub struct NopePre { +pub struct NopePre { instance_pre: wasmtime::component::InstancePre, indices: NopeIndices, } -impl Clone for NopePre { +impl Clone for NopePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NopePre { } } } -impl<_T> NopePre<_T> { +impl<_T: 'static> NopePre<_T> { /// Creates a new copy of `NopePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::a::Host, { foo::foo::a::add_to_linker(linker, get)?; @@ -192,6 +193,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/a")?; @@ -210,6 +212,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/unversioned-foo_async.rs b/crates/component-macro/tests/expanded/unversioned-foo_async.rs index 251d7cde210a..7662a5f88891 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo_async.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Nope`] as well. -pub struct NopePre { +pub struct NopePre { instance_pre: wasmtime::component::InstancePre, indices: NopeIndices, } -impl Clone for NopePre { +impl Clone for NopePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NopePre { } } } -impl<_T> NopePre<_T> { +impl<_T: 'static> NopePre<_T> { /// Creates a new copy of `NopePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::a::Host + Send, { @@ -200,6 +201,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -221,6 +223,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs b/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs index f3319098394b..d08de2f8ebcf 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Nope`] as well. -pub struct NopePre { +pub struct NopePre { instance_pre: wasmtime::component::InstancePre, indices: NopeIndices, } -impl Clone for NopePre { +impl Clone for NopePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NopePre { } } } -impl<_T> NopePre<_T> { +impl<_T: 'static> NopePre<_T> { /// Creates a new copy of `NopePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,7 +149,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::a::Host + 'static, + T: 'static, + T: Send + foo::foo::a::Host, U: Send + foo::foo::a::Host, { foo::foo::a::add_to_linker(linker, get)?; @@ -208,6 +209,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -252,6 +254,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs b/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs index 283a0a2bd18f..e0b368af71a9 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Nope`] as well. -pub struct NopePre { +pub struct NopePre { instance_pre: wasmtime::component::InstancePre, indices: NopeIndices, } -impl Clone for NopePre { +impl Clone for NopePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for NopePre { } } } -impl<_T> NopePre<_T> { +impl<_T: 'static> NopePre<_T> { /// Creates a new copy of `NopePre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::a::Host + Send, { @@ -200,6 +201,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -234,6 +236,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/use-paths.rs b/crates/component-macro/tests/expanded/use-paths.rs index b544748bc2df..9769f3e3006e 100644 --- a/crates/component-macro/tests/expanded/use-paths.rs +++ b/crates/component-macro/tests/expanded/use-paths.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`D`] as well. -pub struct DPre { +pub struct DPre { instance_pre: wasmtime::component::InstancePre, indices: DIndices, } -impl Clone for DPre { +impl Clone for DPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for DPre { } } } -impl<_T> DPre<_T> { +impl<_T: 'static> DPre<_T> { /// Creates a new copy of `DPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -143,6 +143,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::a::Host + foo::foo::b::Host + foo::foo::c::Host + d::Host, { foo::foo::a::add_to_linker(linker, get)?; @@ -182,6 +183,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/a")?; @@ -200,6 +202,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -227,6 +230,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/b")?; @@ -245,6 +249,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -272,6 +277,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/c")?; @@ -290,6 +296,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) @@ -319,6 +326,7 @@ pub mod d { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("d")?; @@ -337,6 +345,7 @@ pub mod d { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/use-paths_async.rs b/crates/component-macro/tests/expanded/use-paths_async.rs index 7afb3414ae7d..ab0c4827ab77 100644 --- a/crates/component-macro/tests/expanded/use-paths_async.rs +++ b/crates/component-macro/tests/expanded/use-paths_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`D`] as well. -pub struct DPre { +pub struct DPre { instance_pre: wasmtime::component::InstancePre, indices: DIndices, } -impl Clone for DPre { +impl Clone for DPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for DPre { } } } -impl<_T> DPre<_T> { +impl<_T: 'static> DPre<_T> { /// Creates a new copy of `DPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::a::Host + foo::foo::b::Host + foo::foo::c::Host + d::Host + Send, @@ -191,6 +192,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -212,6 +214,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -241,6 +244,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -262,6 +266,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -291,6 +296,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -312,6 +318,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -343,6 +350,7 @@ pub mod d { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -364,6 +372,7 @@ pub mod d { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/use-paths_concurrent.rs b/crates/component-macro/tests/expanded/use-paths_concurrent.rs index 25af430f22fc..8a69f26557ca 100644 --- a/crates/component-macro/tests/expanded/use-paths_concurrent.rs +++ b/crates/component-macro/tests/expanded/use-paths_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`D`] as well. -pub struct DPre { +pub struct DPre { instance_pre: wasmtime::component::InstancePre, indices: DIndices, } -impl Clone for DPre { +impl Clone for DPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for DPre { } } } -impl<_T> DPre<_T> { +impl<_T: 'static> DPre<_T> { /// Creates a new copy of `DPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,8 +149,9 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send + foo::foo::a::Host + foo::foo::b::Host - + foo::foo::c::Host + d::Host + 'static, + + foo::foo::c::Host + d::Host, U: Send + foo::foo::a::Host + foo::foo::b::Host + foo::foo::c::Host + d::Host, { @@ -200,6 +201,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -244,6 +246,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -291,6 +294,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -335,6 +339,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -382,6 +387,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -426,6 +432,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { @@ -475,6 +482,7 @@ pub mod d { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -516,6 +524,7 @@ pub mod d { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/use-paths_tracing_async.rs b/crates/component-macro/tests/expanded/use-paths_tracing_async.rs index bb15a7902cf3..acc90319e1e7 100644 --- a/crates/component-macro/tests/expanded/use-paths_tracing_async.rs +++ b/crates/component-macro/tests/expanded/use-paths_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`D`] as well. -pub struct DPre { +pub struct DPre { instance_pre: wasmtime::component::InstancePre, indices: DIndices, } -impl Clone for DPre { +impl Clone for DPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for DPre { } } } -impl<_T> DPre<_T> { +impl<_T: 'static> DPre<_T> { /// Creates a new copy of `DPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -149,6 +149,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::a::Host + foo::foo::b::Host + foo::foo::c::Host + d::Host + Send, @@ -191,6 +192,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -225,6 +227,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -254,6 +257,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -288,6 +292,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -317,6 +322,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -351,6 +357,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { @@ -382,6 +389,7 @@ pub mod d { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -416,6 +424,7 @@ pub mod d { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/variants.rs b/crates/component-macro/tests/expanded/variants.rs index 0a9aa018be62..e467e89776d4 100644 --- a/crates/component-macro/tests/expanded/variants.rs +++ b/crates/component-macro/tests/expanded/variants.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -151,6 +151,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::variants::Host, { foo::foo::variants::add_to_linker(linker, get)?; @@ -514,6 +515,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/variants")?; @@ -753,6 +755,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/variants_async.rs b/crates/component-macro/tests/expanded/variants_async.rs index 89947f8f5226..ad1aee6d5048 100644 --- a/crates/component-macro/tests/expanded/variants_async.rs +++ b/crates/component-macro/tests/expanded/variants_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::variants::Host + Send, { @@ -522,6 +523,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -805,6 +807,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/variants_concurrent.rs b/crates/component-macro/tests/expanded/variants_concurrent.rs index 3a389aaf4e76..2fd1553d796e 100644 --- a/crates/component-macro/tests/expanded/variants_concurrent.rs +++ b/crates/component-macro/tests/expanded/variants_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,7 +157,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::variants::Host + 'static, + T: 'static, + T: Send + foo::foo::variants::Host, U: Send + foo::foo::variants::Host, { foo::foo::variants::add_to_linker(linker, get)?; @@ -683,6 +684,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost< &'a mut T, Host: Host + Send, @@ -1436,6 +1438,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/variants_tracing_async.rs b/crates/component-macro/tests/expanded/variants_tracing_async.rs index 8b88564a8933..72418e696530 100644 --- a/crates/component-macro/tests/expanded/variants_tracing_async.rs +++ b/crates/component-macro/tests/expanded/variants_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`MyWorld`] as well. -pub struct MyWorldPre { +pub struct MyWorldPre { instance_pre: wasmtime::component::InstancePre, indices: MyWorldIndices, } -impl Clone for MyWorldPre { +impl Clone for MyWorldPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for MyWorldPre { } } } -impl<_T> MyWorldPre<_T> { +impl<_T: 'static> MyWorldPre<_T> { /// Creates a new copy of `MyWorldPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -157,6 +157,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::variants::Host + Send, { @@ -522,6 +523,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -1103,6 +1105,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/wat.rs b/crates/component-macro/tests/expanded/wat.rs index 5fb8cafb1b4c..d43c75eb6483 100644 --- a/crates/component-macro/tests/expanded/wat.rs +++ b/crates/component-macro/tests/expanded/wat.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Example`] as well. -pub struct ExamplePre { +pub struct ExamplePre { instance_pre: wasmtime::component::InstancePre, indices: ExampleIndices, } -impl Clone for ExamplePre { +impl Clone for ExamplePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ExamplePre { } } } -impl<_T> ExamplePre<_T> { +impl<_T: 'static> ExamplePre<_T> { /// Creates a new copy of `ExamplePre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/wat_async.rs b/crates/component-macro/tests/expanded/wat_async.rs index c9d80e532631..55a47a3c68da 100644 --- a/crates/component-macro/tests/expanded/wat_async.rs +++ b/crates/component-macro/tests/expanded/wat_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Example`] as well. -pub struct ExamplePre { +pub struct ExamplePre { instance_pre: wasmtime::component::InstancePre, indices: ExampleIndices, } -impl Clone for ExamplePre { +impl Clone for ExamplePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ExamplePre { } } } -impl<_T> ExamplePre<_T> { +impl<_T: 'static> ExamplePre<_T> { /// Creates a new copy of `ExamplePre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/wat_concurrent.rs b/crates/component-macro/tests/expanded/wat_concurrent.rs index 09ec410bd921..8c08894c8a3e 100644 --- a/crates/component-macro/tests/expanded/wat_concurrent.rs +++ b/crates/component-macro/tests/expanded/wat_concurrent.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Example`] as well. -pub struct ExamplePre { +pub struct ExamplePre { instance_pre: wasmtime::component::InstancePre, indices: ExampleIndices, } -impl Clone for ExamplePre { +impl Clone for ExamplePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ExamplePre { } } } -impl<_T> ExamplePre<_T> { +impl<_T: 'static> ExamplePre<_T> { /// Creates a new copy of `ExamplePre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/wat_tracing_async.rs b/crates/component-macro/tests/expanded/wat_tracing_async.rs index c9d80e532631..55a47a3c68da 100644 --- a/crates/component-macro/tests/expanded/wat_tracing_async.rs +++ b/crates/component-macro/tests/expanded/wat_tracing_async.rs @@ -6,11 +6,11 @@ /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Example`] as well. -pub struct ExamplePre { +pub struct ExamplePre { instance_pre: wasmtime::component::InstancePre, indices: ExampleIndices, } -impl Clone for ExamplePre { +impl Clone for ExamplePre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -18,7 +18,7 @@ impl Clone for ExamplePre { } } } -impl<_T> ExamplePre<_T> { +impl<_T: 'static> ExamplePre<_T> { /// Creates a new copy of `ExamplePre` bindings which can then /// be used to instantiate into a particular store. /// diff --git a/crates/component-macro/tests/expanded/worlds-with-types.rs b/crates/component-macro/tests/expanded/worlds-with-types.rs index 52cc2088bef8..3201a22f95b8 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types.rs @@ -31,11 +31,11 @@ const _: () = { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -43,7 +43,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -190,6 +190,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: foo::foo::i::Host, { foo::foo::i::add_to_linker(linker, get)?; @@ -225,6 +226,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host>, { let mut inst = linker.instance("foo:foo/i")?; @@ -235,6 +237,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host, { add_to_linker_get_host(linker, get) diff --git a/crates/component-macro/tests/expanded/worlds-with-types_async.rs b/crates/component-macro/tests/expanded/worlds-with-types_async.rs index 435c51adc0f5..59c7d8a2db05 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types_async.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types_async.rs @@ -31,11 +31,11 @@ const _: () = { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -43,7 +43,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -196,6 +196,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::i::Host + Send, { @@ -236,6 +237,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -247,6 +249,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs b/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs index 0400414eadf6..b841bac3a1ee 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs @@ -31,11 +31,11 @@ const _: () = { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -43,7 +43,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -196,7 +196,8 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where - T: Send + foo::foo::i::Host + 'static, + T: 'static, + T: Send + foo::foo::i::Host, U: Send + foo::foo::i::Host, { foo::foo::i::add_to_linker(linker, get)?; @@ -234,6 +235,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send + 'static, { @@ -245,6 +247,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send + 'static, { diff --git a/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs b/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs index f4d2ff2af544..6814bdbbdc6f 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs @@ -31,11 +31,11 @@ const _: () = { /// has been created through a [`Linker`](wasmtime::component::Linker). /// /// For more information see [`Foo`] as well. -pub struct FooPre { +pub struct FooPre { instance_pre: wasmtime::component::InstancePre, indices: FooIndices, } -impl Clone for FooPre { +impl Clone for FooPre { fn clone(&self) -> Self { Self { instance_pre: self.instance_pre.clone(), @@ -43,7 +43,7 @@ impl Clone for FooPre { } } } -impl<_T> FooPre<_T> { +impl<_T: 'static> FooPre<_T> { /// Creates a new copy of `FooPre` bindings which can then /// be used to instantiate into a particular store. /// @@ -196,6 +196,7 @@ const _: () = { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, T: Send, U: foo::foo::i::Host + Send, { @@ -244,6 +245,7 @@ pub mod foo { host_getter: G, ) -> wasmtime::Result<()> where + T: 'static, G: for<'a> wasmtime::component::GetHost<&'a mut T, Host: Host + Send>, T: Send, { @@ -255,6 +257,7 @@ pub mod foo { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> wasmtime::Result<()> where + T: 'static, U: Host + Send, T: Send, { diff --git a/crates/wasi-common/src/lib.rs b/crates/wasi-common/src/lib.rs index a7574f27975d..d1dd6771ec06 100644 --- a/crates/wasi-common/src/lib.rs +++ b/crates/wasi-common/src/lib.rs @@ -117,6 +117,7 @@ macro_rules! define_wasi { where U: Send + crate::snapshots::preview_0::wasi_unstable::WasiUnstable + crate::snapshots::preview_1::wasi_snapshot_preview1::WasiSnapshotPreview1, + T: 'static, $($bounds)* { snapshots::preview_1::add_wasi_snapshot_preview1_to_linker(linker, get_cx)?; diff --git a/crates/wasi-common/tests/all/async_.rs b/crates/wasi-common/tests/all/async_.rs index 10b70b79c471..cd6407b7c55a 100644 --- a/crates/wasi-common/tests/all/async_.rs +++ b/crates/wasi-common/tests/all/async_.rs @@ -1,6 +1,7 @@ use super::*; use test_programs_artifacts::*; use wasi_common::tokio::{add_to_linker, WasiCtxBuilder}; +use wasi_common::WasiCtx; foreach_preview1!(assert_test_exists); @@ -20,7 +21,7 @@ async fn run(path: &str, inherit_stdio: bool) -> Result<()> { let engine = test_programs_artifacts::engine(|config| { config.async_support(true); }); - let mut linker = Linker::new(&engine); + let mut linker = Linker::::new(&engine); add_to_linker(&mut linker, |cx| cx)?; // Create our wasi context. diff --git a/crates/wasi/src/preview0.rs b/crates/wasi/src/preview0.rs index b67d5fb3e021..44344889c8c3 100644 --- a/crates/wasi/src/preview0.rs +++ b/crates/wasi/src/preview0.rs @@ -9,14 +9,14 @@ use crate::preview1::wasi_snapshot_preview1::WasiSnapshotPreview1 as Snapshot1; use crate::preview1::WasiP1Ctx; use wiggle::{GuestError, GuestMemory, GuestPtr}; -pub fn add_to_linker_async( +pub fn add_to_linker_async( linker: &mut wasmtime::Linker, f: impl Fn(&mut T) -> &mut WasiP1Ctx + Copy + Send + Sync + 'static, ) -> anyhow::Result<()> { wasi_unstable::add_to_linker(linker, f) } -pub fn add_to_linker_sync( +pub fn add_to_linker_sync( linker: &mut wasmtime::Linker, f: impl Fn(&mut T) -> &mut WasiP1Ctx + Copy + Send + Sync + 'static, ) -> anyhow::Result<()> { diff --git a/crates/wasi/src/preview1.rs b/crates/wasi/src/preview1.rs index 3285ff45b25b..e64a28dd588a 100644 --- a/crates/wasi/src/preview1.rs +++ b/crates/wasi/src/preview1.rs @@ -739,7 +739,7 @@ enum FdWrite { /// Ok(()) /// } /// ``` -pub fn add_to_linker_async( +pub fn add_to_linker_async( linker: &mut wasmtime::Linker, f: impl Fn(&mut T) -> &mut WasiP1Ctx + Copy + Send + Sync + 'static, ) -> anyhow::Result<()> { @@ -813,7 +813,7 @@ pub fn add_to_linker_async( /// Ok(()) /// } /// ``` -pub fn add_to_linker_sync( +pub fn add_to_linker_sync( linker: &mut wasmtime::Linker, f: impl Fn(&mut T) -> &mut WasiP1Ctx + Copy + Send + Sync + 'static, ) -> anyhow::Result<()> { diff --git a/crates/wasmtime/src/runtime/component/func.rs b/crates/wasmtime/src/runtime/component/func.rs index f6add6da6846..51a3ac265924 100644 --- a/crates/wasmtime/src/runtime/component/func.rs +++ b/crates/wasmtime/src/runtime/component/func.rs @@ -294,15 +294,12 @@ impl Func { /// only works with functions defined within an asynchronous store. Also /// panics if `store` does not own this function. #[cfg(feature = "async")] - pub async fn call_async( + pub async fn call_async( &self, - mut store: impl AsContextMut, + mut store: impl AsContextMut, params: &[Val], results: &mut [Val], - ) -> Result<()> - where - T: Send, - { + ) -> Result<()> { let mut store = store.as_context_mut(); assert!( store.0.async_support(), @@ -556,10 +553,7 @@ impl Func { /// Panics if this is called on a function in a synchronous store. This /// only works with functions defined within an asynchronous store. #[cfg(feature = "async")] - pub async fn post_return_async( - &self, - mut store: impl AsContextMut, - ) -> Result<()> { + pub async fn post_return_async(&self, mut store: impl AsContextMut) -> Result<()> { let mut store = store.as_context_mut(); assert!( store.0.async_support(), diff --git a/crates/wasmtime/src/runtime/component/func/host.rs b/crates/wasmtime/src/runtime/component/func/host.rs index 1e8bf946a081..d8546349261b 100644 --- a/crates/wasmtime/src/runtime/component/func/host.rs +++ b/crates/wasmtime/src/runtime/component/func/host.rs @@ -35,6 +35,7 @@ impl HostFunc { F: Fn(StoreContextMut, P) -> Result + Send + Sync + 'static, P: ComponentNamedList + Lift + 'static, R: ComponentNamedList + Lower + 'static, + T: 'static, { let entrypoint = Self::entrypoint::; Arc::new(HostFunc { @@ -61,6 +62,7 @@ impl HostFunc { F: Fn(StoreContextMut, P) -> Result, P: ComponentNamedList + Lift + 'static, R: ComponentNamedList + Lower + 'static, + T: 'static, { let data = data.as_ptr() as *const F; unsafe { @@ -85,6 +87,7 @@ impl HostFunc { pub(crate) fn new_dynamic(func: F) -> Arc where F: Fn(StoreContextMut<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static, + T: 'static, { Arc::new(HostFunc { entrypoint: dynamic_entrypoint::, @@ -310,7 +313,10 @@ unsafe fn call_host_and_handle_result( &Arc, StoreContextMut<'_, T>, ) -> Result<()>, -) -> bool { +) -> bool +where + T: 'static, +{ let cx = VMComponentContext::from_opaque(cx); let instance = cx.as_ref().instance(); let types = (*instance).component_types(); @@ -340,6 +346,7 @@ unsafe fn call_host_dynamic( ) -> Result<()> where F: FnOnce(StoreContextMut<'_, T>, &[Val], &mut [Val]) -> Result<()>, + T: 'static, { if async_ { todo!() @@ -455,6 +462,7 @@ extern "C" fn dynamic_entrypoint( ) -> bool where F: Fn(StoreContextMut<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static, + T: 'static, { let data = data.as_ptr() as *const F; unsafe { diff --git a/crates/wasmtime/src/runtime/component/func/options.rs b/crates/wasmtime/src/runtime/component/func/options.rs index 6dfe2bad03c9..331f83fd8169 100644 --- a/crates/wasmtime/src/runtime/component/func/options.rs +++ b/crates/wasmtime/src/runtime/component/func/options.rs @@ -173,7 +173,7 @@ impl Options { /// contextual information necessary related to the context in which the /// lowering is happening. #[doc(hidden)] -pub struct LowerContext<'a, T> { +pub struct LowerContext<'a, T: 'static> { /// Lowering may involve invoking memory allocation functions so part of the /// context here is carrying access to the entire store that wasm is /// executing within. This store serves as proof-of-ability to actually @@ -201,7 +201,7 @@ pub struct LowerContext<'a, T> { } #[doc(hidden)] -impl<'a, T> LowerContext<'a, T> { +impl<'a, T: 'static> LowerContext<'a, T> { /// Creates a new lowering context from the specified parameters. /// /// # Unsafety diff --git a/crates/wasmtime/src/runtime/component/func/typed.rs b/crates/wasmtime/src/runtime/component/func/typed.rs index bd978dbc51c0..01a852be828a 100644 --- a/crates/wasmtime/src/runtime/component/func/typed.rs +++ b/crates/wasmtime/src/runtime/component/func/typed.rs @@ -174,13 +174,12 @@ where /// only works with functions defined within an asynchronous store. Also /// panics if `store` does not own this function. #[cfg(feature = "async")] - pub async fn call_async( + pub async fn call_async( &self, - mut store: impl AsContextMut, + mut store: impl AsContextMut, params: Params, ) -> Result where - T: Send, Params: Send + Sync, Return: Send + Sync, { @@ -201,9 +200,9 @@ where /// made using this method may run concurrently with other calls to the same /// instance. #[cfg(feature = "component-model-async")] - pub async fn call_concurrent( + pub async fn call_concurrent( self, - mut store: impl AsContextMut, + mut store: impl AsContextMut, params: Params, ) -> Result> where @@ -1383,7 +1382,10 @@ impl WasmStr { // in an opt-in basis don't do validation. Additionally there should be some // method that returns `[u16]` after validating to avoid the utf16-to-utf8 // transcode. - pub fn to_str<'a, T: 'a>(&self, store: impl Into>) -> Result> { + pub fn to_str<'a, T: 'static>( + &self, + store: impl Into>, + ) -> Result> { let store = store.into().0; let memory = self.options.memory(store); self.to_str_from_memory(memory) @@ -1666,7 +1668,7 @@ impl WasmList { /// /// Each item of the list may fail to decode and is represented through the /// `Result` value of the iterator. - pub fn iter<'a, U: 'a>( + pub fn iter<'a, U: 'static>( &'a self, store: impl Into>, ) -> impl ExactSizeIterator> + 'a { @@ -1699,7 +1701,7 @@ macro_rules! raw_wasm_list_accessors { /// /// Panics if the `store` provided is not the one from which this /// slice originated. - pub fn as_le_slice<'a, T: 'a>(&self, store: impl Into>) -> &'a [$i] { + pub fn as_le_slice<'a, T: 'static>(&self, store: impl Into>) -> &'a [$i] { let memory = self.options.memory(store.into().0); self._as_le_slice(memory) } diff --git a/crates/wasmtime/src/runtime/component/instance.rs b/crates/wasmtime/src/runtime/component/instance.rs index ff15ae8d8140..e4138e139519 100644 --- a/crates/wasmtime/src/runtime/component/instance.rs +++ b/crates/wasmtime/src/runtime/component/instance.rs @@ -826,7 +826,7 @@ impl<'a> Instantiator<'a> { /// type is created. This type is primarily created through the /// [`Linker::instantiate_pre`](crate::component::Linker::instantiate_pre) /// method. -pub struct InstancePre { +pub struct InstancePre { component: Component, imports: Arc>, resource_types: Arc>, @@ -834,7 +834,7 @@ pub struct InstancePre { } // `InstancePre`'s clone does not require `T: Clone` -impl Clone for InstancePre { +impl Clone for InstancePre { fn clone(&self) -> Self { Self { component: self.component.clone(), @@ -845,7 +845,7 @@ impl Clone for InstancePre { } } -impl InstancePre { +impl InstancePre { /// This function is `unsafe` since there's no guarantee that the /// `RuntimeImport` items provided are guaranteed to work with the `T` of /// the store. diff --git a/crates/wasmtime/src/runtime/component/linker.rs b/crates/wasmtime/src/runtime/component/linker.rs index 69599fc6a25b..76f0e7e53fae 100644 --- a/crates/wasmtime/src/runtime/component/linker.rs +++ b/crates/wasmtime/src/runtime/component/linker.rs @@ -56,7 +56,7 @@ use wasmtime_environ::PrimaryMap; /// for guests to upgrade WASI. So long as the actual "meat" of the /// functionality is defined then it should align correctly and components can /// be instantiated. -pub struct Linker { +pub struct Linker { engine: Engine, strings: Strings, map: NameMap, @@ -65,7 +65,7 @@ pub struct Linker { _marker: marker::PhantomData T>, } -impl Clone for Linker { +impl Clone for Linker { fn clone(&self) -> Linker { Linker { engine: self.engine.clone(), @@ -89,7 +89,7 @@ pub struct Strings { /// Instances do not need to be actual [`Instance`]s and instead are defined by /// a "bag of named items", so each [`LinkerInstance`] can further define items /// internally. -pub struct LinkerInstance<'a, T> { +pub struct LinkerInstance<'a, T: 'static> { engine: &'a Engine, path: &'a mut Vec, path_len: usize, @@ -107,7 +107,7 @@ pub(crate) enum Definition { Resource(ResourceType, Arc), } -impl Linker { +impl Linker { /// Creates a new linker for the [`Engine`] specified with no items defined /// within it. pub fn new(engine: &Engine) -> Linker { @@ -377,7 +377,7 @@ impl Linker { } } -impl LinkerInstance<'_, T> { +impl LinkerInstance<'_, T> { fn as_mut(&mut self) -> LinkerInstance<'_, T> { LinkerInstance { engine: self.engine, diff --git a/crates/wasmtime/src/runtime/component/resources.rs b/crates/wasmtime/src/runtime/component/resources.rs index e198fb3d4851..bd24adba9bd9 100644 --- a/crates/wasmtime/src/runtime/component/resources.rs +++ b/crates/wasmtime/src/runtime/component/resources.rs @@ -1010,10 +1010,10 @@ impl ResourceAny { /// Same as [`ResourceAny::resource_drop`] except for use with async stores /// to execute the destructor asynchronously. #[cfg(feature = "async")] - pub async fn resource_drop_async(self, mut store: impl AsContextMut) -> Result<()> - where - T: Send, - { + pub async fn resource_drop_async( + self, + mut store: impl AsContextMut, + ) -> Result<()> { let mut store = store.as_context_mut(); assert!( store.0.async_support(), @@ -1024,7 +1024,7 @@ impl ResourceAny { .await? } - fn resource_drop_impl(self, store: &mut StoreContextMut<'_, T>) -> Result<()> { + fn resource_drop_impl(self, store: &mut StoreContextMut<'_, T>) -> Result<()> { // Attempt to remove `self.idx` from the host table in `store`. // // This could fail if the index is invalid or if this is removing an diff --git a/crates/wasmtime/src/runtime/coredump.rs b/crates/wasmtime/src/runtime/coredump.rs index 1a55c3f4696b..d24c943724cf 100644 --- a/crates/wasmtime/src/runtime/coredump.rs +++ b/crates/wasmtime/src/runtime/coredump.rs @@ -103,7 +103,7 @@ impl WasmCoreDump { self._serialize(store, name) } - fn _serialize(&self, mut store: StoreContextMut<'_, T>, name: &str) -> Vec { + fn _serialize(&self, mut store: StoreContextMut<'_, T>, name: &str) -> Vec { let mut core_dump = wasm_encoder::Module::new(); core_dump.section(&wasm_encoder::CoreDumpSection::new(name)); diff --git a/crates/wasmtime/src/runtime/externals/table.rs b/crates/wasmtime/src/runtime/externals/table.rs index ab36003dca8d..e6783f97188d 100644 --- a/crates/wasmtime/src/runtime/externals/table.rs +++ b/crates/wasmtime/src/runtime/externals/table.rs @@ -85,14 +85,11 @@ impl Table { /// This function will panic when used with a non-async /// [`Store`](`crate::Store`) #[cfg(feature = "async")] - pub async fn new_async( - mut store: impl AsContextMut, + pub async fn new_async( + mut store: impl AsContextMut, ty: TableType, init: Ref, - ) -> Result - where - T: Send, - { + ) -> Result
{ let mut store = store.as_context_mut(); assert!( store.0.async_support(), @@ -278,15 +275,12 @@ impl Table { /// This function will panic when used with a non-async /// [`Store`](`crate::Store`). #[cfg(feature = "async")] - pub async fn grow_async( + pub async fn grow_async( &self, - mut store: impl AsContextMut, + mut store: impl AsContextMut, delta: u64, init: Ref, - ) -> Result - where - T: Send, - { + ) -> Result { let mut store = store.as_context_mut(); assert!( store.0.async_support(), diff --git a/crates/wasmtime/src/runtime/func.rs b/crates/wasmtime/src/runtime/func.rs index 7652eea62ea0..d4a5790b074b 100644 --- a/crates/wasmtime/src/runtime/func.rs +++ b/crates/wasmtime/src/runtime/func.rs @@ -412,7 +412,7 @@ impl Func { /// /// Panics if the given function type is not associated with this store's /// engine. - pub fn new( + pub fn new( store: impl AsContextMut, ty: FuncType, func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static, @@ -454,7 +454,7 @@ impl Func { /// /// Panics if the given function type is not associated with this store's /// engine. - pub unsafe fn new_unchecked( + pub unsafe fn new_unchecked( mut store: impl AsContextMut, ty: FuncType, func: impl Fn(Caller<'_, T>, &mut [ValRaw]) -> Result<()> + Send + Sync + 'static, @@ -548,6 +548,7 @@ impl Func { + Send + Sync + 'static, + T: 'static, { assert!( store.as_context().async_support(), @@ -826,7 +827,10 @@ impl Func { pub fn wrap( mut store: impl AsContextMut, func: impl IntoFunc, - ) -> Func { + ) -> Func + where + T: 'static, + { let store = store.as_context_mut().0; // part of this unsafety is about matching the `T` to a `Store`, // which is done through the `AsContextMut` bound above. @@ -842,6 +846,7 @@ impl Func { F: Fn(Caller<'_, T>, Params) -> Results + Send + Sync + 'static, Params: WasmTyList, Results: WasmRet, + T: 'static, { let store = store.as_context_mut().0; // part of this unsafety is about matching the `T` to a `Store`, @@ -868,6 +873,7 @@ impl Func { + 'static, P: WasmTyList, R: WasmRet, + T: 'static, { assert!( store.as_context().async_support(), @@ -1141,15 +1147,12 @@ impl Func { /// only works with functions defined within an asynchronous store. Also /// panics if `store` does not own this function. #[cfg(feature = "async")] - pub async fn call_async( + pub async fn call_async( &self, - mut store: impl AsContextMut, + mut store: impl AsContextMut, params: &[Val], results: &mut [Val], - ) -> Result<()> - where - T: Send, - { + ) -> Result<()> { let mut store = store.as_context_mut(); assert!( store.0.async_support(), @@ -1962,6 +1965,7 @@ macro_rules! impl_into_func { F: Fn($arg) -> R + Send + Sync + 'static, $arg: WasmTy, R: WasmRet, + T: 'static, { fn into_func(self, engine: &Engine) -> HostContext { let f = move |_: Caller<'_, T>, $arg: $arg| { @@ -1978,6 +1982,7 @@ macro_rules! impl_into_func { F: Fn(Caller<'_, T>, $arg) -> R + Send + Sync + 'static, $arg: WasmTy, R: WasmRet, + T: 'static, { fn into_func(self, engine: &Engine) -> HostContext { HostContext::from_closure(engine, move |caller: Caller<'_, T>, ($arg,)| { @@ -1996,6 +2001,7 @@ macro_rules! impl_into_func { F: Fn($($args),*) -> R + Send + Sync + 'static, $($args: WasmTy,)* R: WasmRet, + T: 'static, { fn into_func(self, engine: &Engine) -> HostContext { let f = move |_: Caller<'_, T>, $($args:$args),*| { @@ -2012,6 +2018,7 @@ macro_rules! impl_into_func { F: Fn(Caller<'_, T>, $($args),*) -> R + Send + Sync + 'static, $($args: WasmTy,)* R: WasmRet, + T: 'static, { fn into_func(self, engine: &Engine) -> HostContext { HostContext::from_closure(engine, move |caller: Caller<'_, T>, ( $( $args ),* )| { @@ -2094,7 +2101,7 @@ for_each_function_signature!(impl_wasm_ty_list); /// /// Host functions which want access to [`Store`](crate::Store)-level state are /// recommended to use this type. -pub struct Caller<'a, T> { +pub struct Caller<'a, T: 'static> { pub(crate) store: StoreContextMut<'a, T>, caller: &'a crate::runtime::vm::Instance, } @@ -2277,7 +2284,7 @@ impl Caller<'_, T> { #[cfg(all(feature = "async", feature = "gc"))] pub async fn gc_async(&mut self, why: Option<&crate::GcHeapOutOfMemory<()>>) -> Result<()> where - T: Send, + T: Send + 'static, { self.store.gc_async(why).await } @@ -2305,14 +2312,14 @@ impl Caller<'_, T> { } } -impl AsContext for Caller<'_, T> { +impl AsContext for Caller<'_, T> { type Data = T; fn as_context(&self) -> StoreContext<'_, T> { self.store.as_context() } } -impl AsContextMut for Caller<'_, T> { +impl AsContextMut for Caller<'_, T> { fn as_context_mut(&mut self) -> StoreContextMut<'_, T> { self.store.as_context_mut() } @@ -2346,6 +2353,7 @@ impl HostContext { F: Fn(Caller<'_, T>, P) -> R + Send + Sync + 'static, P: WasmTyList, R: WasmRet, + T: 'static, { let ty = R::func_type(engine, None::.into_iter().chain(P::valtypes())); let type_index = ty.type_index(); @@ -2376,6 +2384,7 @@ impl HostContext { F: Fn(Caller<'_, T>, P) -> R + 'static, P: WasmTyList, R: WasmRet, + T: 'static, { // Note that this function is intentionally scoped into a // separate closure. Handling traps and panics will involve @@ -2474,7 +2483,10 @@ impl HostFunc { engine: &Engine, ty: FuncType, func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static, - ) -> Self { + ) -> Self + where + T: 'static, + { assert!(ty.comes_from_same_engine(engine)); let ty_clone = ty.clone(); unsafe { @@ -2494,7 +2506,10 @@ impl HostFunc { engine: &Engine, ty: FuncType, func: impl Fn(Caller<'_, T>, &mut [ValRaw]) -> Result<()> + Send + Sync + 'static, - ) -> Self { + ) -> Self + where + T: 'static, + { assert!(ty.comes_from_same_engine(engine)); let func = move |caller_vmctx, values: &mut [ValRaw]| { Caller::::with(caller_vmctx, |mut caller| { @@ -2516,6 +2531,7 @@ impl HostFunc { F: Fn(Caller<'_, T>, Params) -> Results + Send + Sync + 'static, Params: WasmTyList, Results: WasmRet, + T: 'static, { let ctx = HostContext::from_closure(engine, func); HostFunc::_new(engine, ctx) @@ -2525,7 +2541,10 @@ impl HostFunc { pub fn wrap( engine: &Engine, func: impl IntoFunc, - ) -> Self { + ) -> Self + where + T: 'static, + { let ctx = func.into_func(engine); HostFunc::_new(engine, ctx) } diff --git a/crates/wasmtime/src/runtime/func/typed.rs b/crates/wasmtime/src/runtime/func/typed.rs index a5fb841dec49..249cf54982e4 100644 --- a/crates/wasmtime/src/runtime/func/typed.rs +++ b/crates/wasmtime/src/runtime/func/typed.rs @@ -128,14 +128,11 @@ where /// /// [`Trap`]: crate::Trap #[cfg(feature = "async")] - pub async fn call_async( + pub async fn call_async( &self, - mut store: impl AsContextMut, + mut store: impl AsContextMut, params: Params, - ) -> Result - where - T: Send, - { + ) -> Result { let mut store = store.as_context_mut(); assert!( store.0.async_support(), diff --git a/crates/wasmtime/src/runtime/gc/disabled/arrayref.rs b/crates/wasmtime/src/runtime/gc/disabled/arrayref.rs index 08b148a83587..013ded596da5 100644 --- a/crates/wasmtime/src/runtime/gc/disabled/arrayref.rs +++ b/crates/wasmtime/src/runtime/gc/disabled/arrayref.rs @@ -30,7 +30,7 @@ impl ArrayRef { match *self {} } - pub fn elems<'a, T: 'a>( + pub fn elems<'a, T: 'static>( &self, _store: impl Into>, ) -> Result + 'a + '_> { diff --git a/crates/wasmtime/src/runtime/gc/disabled/externref.rs b/crates/wasmtime/src/runtime/gc/disabled/externref.rs index 55ef89e09a2d..b5ddb0e46adf 100644 --- a/crates/wasmtime/src/runtime/gc/disabled/externref.rs +++ b/crates/wasmtime/src/runtime/gc/disabled/externref.rs @@ -18,7 +18,7 @@ impl ExternRef { unreachable!() } - pub fn data<'a, T>( + pub fn data<'a, T: 'static>( &self, _store: impl Into>, ) -> Result<&'a (dyn Any + Send + Sync)> @@ -28,7 +28,7 @@ impl ExternRef { match *self {} } - pub fn data_mut<'a, T>( + pub fn data_mut<'a, T: 'static>( &self, _store: impl Into>, ) -> Result<&'a mut (dyn Any + Send + Sync)> diff --git a/crates/wasmtime/src/runtime/gc/disabled/structref.rs b/crates/wasmtime/src/runtime/gc/disabled/structref.rs index 6f5819d6c1bb..31be058ccd42 100644 --- a/crates/wasmtime/src/runtime/gc/disabled/structref.rs +++ b/crates/wasmtime/src/runtime/gc/disabled/structref.rs @@ -26,7 +26,7 @@ impl StructRef { match *self {} } - pub fn fields<'a, T: 'a>( + pub fn fields<'a, T: 'static>( &self, _store: impl Into>, ) -> Result + 'a + '_> { diff --git a/crates/wasmtime/src/runtime/gc/enabled/arrayref.rs b/crates/wasmtime/src/runtime/gc/enabled/arrayref.rs index 25999b7c148b..57c2200faac5 100644 --- a/crates/wasmtime/src/runtime/gc/enabled/arrayref.rs +++ b/crates/wasmtime/src/runtime/gc/enabled/arrayref.rs @@ -653,7 +653,7 @@ impl ArrayRef { /// # Panics /// /// Panics if this reference is associated with a different store. - pub fn elems<'a, T: 'a>( + pub fn elems<'a, T: 'static>( &'a self, store: impl Into>, ) -> Result + 'a> { diff --git a/crates/wasmtime/src/runtime/gc/enabled/externref.rs b/crates/wasmtime/src/runtime/gc/enabled/externref.rs index 659296300a81..97388b18592f 100644 --- a/crates/wasmtime/src/runtime/gc/enabled/externref.rs +++ b/crates/wasmtime/src/runtime/gc/enabled/externref.rs @@ -478,7 +478,7 @@ impl ExternRef { store: impl Into>, ) -> Result> where - T: 'a, + T: 'static, { let store = store.into().0; let gc_ref = self.inner.try_gc_ref(&store)?; @@ -526,7 +526,7 @@ impl ExternRef { store: impl Into>, ) -> Result> where - T: 'a, + T: 'static, { let store = store.into().0; // NB: need to do an unchecked copy to release the borrow on the store diff --git a/crates/wasmtime/src/runtime/gc/enabled/structref.rs b/crates/wasmtime/src/runtime/gc/enabled/structref.rs index af41d3658c9f..8e50f1f07135 100644 --- a/crates/wasmtime/src/runtime/gc/enabled/structref.rs +++ b/crates/wasmtime/src/runtime/gc/enabled/structref.rs @@ -459,7 +459,7 @@ impl StructRef { /// # Panics /// /// Panics if this reference is associated with a different store. - pub fn fields<'a, T: 'a>( + pub fn fields<'a, T: 'static>( &'a self, store: impl Into>, ) -> Result + 'a> { diff --git a/crates/wasmtime/src/runtime/instance.rs b/crates/wasmtime/src/runtime/instance.rs index d47827e12bc9..f87b4d034535 100644 --- a/crates/wasmtime/src/runtime/instance.rs +++ b/crates/wasmtime/src/runtime/instance.rs @@ -145,14 +145,11 @@ impl Instance { /// This function will also panic, like [`Instance::new`], if any [`Extern`] /// specified does not belong to `store`. #[cfg(feature = "async")] - pub async fn new_async( - mut store: impl AsContextMut, + pub async fn new_async( + mut store: impl AsContextMut, module: &Module, imports: &[Extern], - ) -> Result - where - T: Send, - { + ) -> Result { let mut store = store.as_context_mut(); let imports = Instance::typecheck_externs(store.0, module, imports)?; // See `new` for notes on this unsafety @@ -221,7 +218,7 @@ impl Instance { imports: Imports<'_>, ) -> Result where - T: Send, + T: Send + 'static, { assert!( store.0.async_support(), @@ -374,7 +371,7 @@ impl Instance { } /// Get this instance's module. - pub fn module<'a, T: 'a>(&self, store: impl Into>) -> &'a Module { + pub fn module<'a, T: 'static>(&self, store: impl Into>) -> &'a Module { self._module(store.into().0) } @@ -388,7 +385,7 @@ impl Instance { /// # Panics /// /// Panics if `store` does not own this instance. - pub fn exports<'a, T: 'a>( + pub fn exports<'a, T: 'static>( &'a self, store: impl Into>, ) -> impl ExactSizeIterator> + 'a { @@ -824,7 +821,7 @@ impl Clone for InstancePre { } } -impl InstancePre { +impl InstancePre { /// Creates a new `InstancePre` which type-checks the `items` provided and /// on success is ready to instantiate a new instance. /// @@ -917,11 +914,8 @@ impl InstancePre { #[cfg(feature = "async")] pub async fn instantiate_async( &self, - mut store: impl AsContextMut, - ) -> Result - where - T: Send, - { + mut store: impl AsContextMut, + ) -> Result { let mut store = store.as_context_mut(); let imports = pre_instantiate_raw( &mut store.0, diff --git a/crates/wasmtime/src/runtime/linker.rs b/crates/wasmtime/src/runtime/linker.rs index 87d6afcdd3d1..af4a78dcf2a0 100644 --- a/crates/wasmtime/src/runtime/linker.rs +++ b/crates/wasmtime/src/runtime/linker.rs @@ -240,7 +240,10 @@ impl Linker { /// # Ok(()) /// # } /// ``` - pub fn define_unknown_imports_as_traps(&mut self, module: &Module) -> anyhow::Result<()> { + pub fn define_unknown_imports_as_traps(&mut self, module: &Module) -> anyhow::Result<()> + where + T: 'static, + { for import in module.imports() { if let Err(import_err) = self._get_by_import(&import) { if let ExternType::Func(func_ty) = import_err.ty() { @@ -278,7 +281,10 @@ impl Linker { &mut self, store: &mut impl AsContextMut, module: &Module, - ) -> anyhow::Result<()> { + ) -> anyhow::Result<()> + where + T: 'static, + { for import in module.imports() { if let Err(import_err) = self._get_by_import(&import) { let default_extern = @@ -346,7 +352,10 @@ impl Linker { module: &str, name: &str, item: impl Into, - ) -> Result<&mut Self> { + ) -> Result<&mut Self> + where + T: 'static, + { let store = store.as_context(); let key = self.import_key(module, Some(name)); self.insert(key, Definition::new(store.0, item.into()))?; @@ -364,7 +373,10 @@ impl Linker { store: impl AsContext, name: &str, item: impl Into, - ) -> Result<&mut Self> { + ) -> Result<&mut Self> + where + T: 'static, + { let store = store.as_context(); let key = self.import_key(name, None); self.insert(key, Definition::new(store.0, item.into()))?; @@ -385,7 +397,10 @@ impl Linker { name: &str, ty: FuncType, func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static, - ) -> Result<&mut Self> { + ) -> Result<&mut Self> + where + T: 'static, + { assert!(ty.comes_from_same_engine(self.engine())); let func = HostFunc::new(&self.engine, ty, func); let key = self.import_key(module, Some(name)); @@ -407,7 +422,10 @@ impl Linker { name: &str, ty: FuncType, func: impl Fn(Caller<'_, T>, &mut [ValRaw]) -> Result<()> + Send + Sync + 'static, - ) -> Result<&mut Self> { + ) -> Result<&mut Self> + where + T: 'static, + { assert!(ty.comes_from_same_engine(self.engine())); let func = HostFunc::new_unchecked(&self.engine, ty, func); let key = self.import_key(module, Some(name)); @@ -445,6 +463,7 @@ impl Linker { + Send + Sync + 'static, + T: 'static, { assert!( self.engine.config().async_support, @@ -527,7 +546,10 @@ impl Linker { module: &str, name: &str, func: impl IntoFunc, - ) -> Result<&mut Self> { + ) -> Result<&mut Self> + where + T: 'static, + { let func = HostFunc::wrap(&self.engine, func); let key = self.import_key(module, Some(name)); self.insert(key, Definition::HostFunc(Arc::new(func)))?; @@ -547,6 +569,7 @@ impl Linker { + Send + Sync + 'static, + T: 'static, { assert!( self.engine.config().async_support, @@ -634,7 +657,10 @@ impl Linker { mut store: impl AsContextMut, module_name: &str, instance: Instance, - ) -> Result<&mut Self> { + ) -> Result<&mut Self> + where + T: 'static, + { let mut store = store.as_context_mut(); let exports = instance .exports(&mut store) @@ -1101,7 +1127,10 @@ impl Linker { &self, mut store: impl AsContextMut, module: &Module, - ) -> Result { + ) -> Result + where + T: 'static, + { self._instantiate_pre(module, Some(store.as_context_mut().0))? .instantiate(store) } @@ -1115,7 +1144,7 @@ impl Linker { module: &Module, ) -> Result where - T: Send, + T: Send + 'static, { self._instantiate_pre(module, Some(store.as_context_mut().0))? .instantiate_async(store) @@ -1169,7 +1198,10 @@ impl Linker { /// # Ok(()) /// # } /// ``` - pub fn instantiate_pre(&self, module: &Module) -> Result> { + pub fn instantiate_pre(&self, module: &Module) -> Result> + where + T: 'static, + { self._instantiate_pre(module, None) } @@ -1188,7 +1220,10 @@ impl Linker { &self, module: &Module, store: Option<&StoreOpaque>, - ) -> Result> { + ) -> Result> + where + T: 'static, + { let mut imports = module .imports() .map(|import| self._get_by_import(&import)) @@ -1218,7 +1253,10 @@ impl Linker { pub fn iter<'a: 'p, 'p>( &'a self, mut store: impl AsContextMut + 'p, - ) -> impl Iterator + 'p { + ) -> impl Iterator + 'p + where + T: 'static, + { self.map.iter().map(move |(key, item)| { let store = store.as_context_mut(); ( @@ -1245,7 +1283,10 @@ impl Linker { mut store: impl AsContextMut, module: &str, name: &str, - ) -> Option { + ) -> Option + where + T: 'static, + { let store = store.as_context_mut().0; // Should be safe since `T` is connecting the linker and store Some(unsafe { self._get(module, name)?.to_extern(store) }) @@ -1272,7 +1313,10 @@ impl Linker { &self, mut store: impl AsContextMut, import: &ImportType, - ) -> Option { + ) -> Option + where + T: 'static, + { let store = store.as_context_mut().0; // Should be safe since `T` is connecting the linker and store Some(unsafe { self._get_by_import(import).ok()?.to_extern(store) }) @@ -1295,11 +1339,10 @@ impl Linker { /// Panics if the default function found is not owned by `store`. This /// function will also panic if the `store` provided does not come from the /// same [`Engine`] that this linker was created with. - pub fn get_default( - &self, - mut store: impl AsContextMut, - module: &str, - ) -> Result { + pub fn get_default(&self, mut store: impl AsContextMut, module: &str) -> Result + where + T: 'static, + { if let Some(external) = self.get(&mut store, module, "") { if let Extern::Func(func) = external { return Ok(func); @@ -1320,7 +1363,7 @@ impl Linker { } } -impl Default for Linker { +impl Default for Linker { fn default() -> Linker { Linker::new(&Engine::default()) } diff --git a/crates/wasmtime/src/runtime/memory.rs b/crates/wasmtime/src/runtime/memory.rs index 498d04966cda..f1844b058ee0 100644 --- a/crates/wasmtime/src/runtime/memory.rs +++ b/crates/wasmtime/src/runtime/memory.rs @@ -254,13 +254,10 @@ impl Memory { /// This function will panic when used with a non-async /// [`Store`](`crate::Store`). #[cfg(feature = "async")] - pub async fn new_async( - mut store: impl AsContextMut, + pub async fn new_async( + mut store: impl AsContextMut, ty: MemoryType, - ) -> Result - where - T: Send, - { + ) -> Result { let mut store = store.as_context_mut(); assert!( store.0.async_support(), @@ -362,7 +359,7 @@ impl Memory { /// # Panics /// /// Panics if this memory doesn't belong to `store`. - pub fn data<'a, T: 'a>(&self, store: impl Into>) -> &'a [u8] { + pub fn data<'a, T: 'static>(&self, store: impl Into>) -> &'a [u8] { unsafe { let store = store.into(); let definition = store[self.0].definition.as_ref(); @@ -379,7 +376,10 @@ impl Memory { /// # Panics /// /// Panics if this memory doesn't belong to `store`. - pub fn data_mut<'a, T: 'a>(&self, store: impl Into>) -> &'a mut [u8] { + pub fn data_mut<'a, T: 'static>( + &self, + store: impl Into>, + ) -> &'a mut [u8] { unsafe { let store = store.into(); let definition = store[self.0].definition.as_ref(); @@ -400,7 +400,7 @@ impl Memory { /// # Panics /// /// Panics if this memory doesn't belong to `store`. - pub fn data_and_store_mut<'a, T: 'a>( + pub fn data_and_store_mut<'a, T: 'static>( &self, store: impl Into>, ) -> (&'a mut [u8], &'a mut T) { @@ -605,14 +605,11 @@ impl Memory { /// This function will panic when used with a non-async /// [`Store`](`crate::Store`). #[cfg(feature = "async")] - pub async fn grow_async( + pub async fn grow_async( &self, - mut store: impl AsContextMut, + mut store: impl AsContextMut, delta: u64, - ) -> Result - where - T: Send, - { + ) -> Result { let mut store = store.as_context_mut(); assert!( store.0.async_support(), diff --git a/crates/wasmtime/src/runtime/store.rs b/crates/wasmtime/src/runtime/store.rs index 999d4b87415f..4f876f4d86f2 100644 --- a/crates/wasmtime/src/runtime/store.rs +++ b/crates/wasmtime/src/runtime/store.rs @@ -178,7 +178,7 @@ mod gc; /// operations is incorrect. In other words it's considered a programmer error /// rather than a recoverable error for the wrong [`Store`] to be used when /// calling APIs. -pub struct Store { +pub struct Store { // for comments about `ManuallyDrop`, see `Store::into_data` inner: ManuallyDrop>>, } @@ -219,7 +219,7 @@ impl CallHook { /// The members of this struct are those that need to be generic over `T`, the /// store's internal type storage. Otherwise all things that don't rely on `T` /// should go into `StoreOpaque`. -pub struct StoreInner { +pub struct StoreInner { /// Generic metadata about the store that doesn't need access to `T`. inner: StoreOpaque, @@ -238,7 +238,7 @@ enum ResourceLimiterInner { Async(Box &mut (dyn crate::ResourceLimiterAsync) + Send + Sync>), } -enum CallHookInner { +enum CallHookInner { #[cfg(feature = "call-hook")] Sync(Box, CallHook) -> Result<()> + Send + Sync>), #[cfg(all(feature = "async", feature = "call-hook"))] @@ -599,16 +599,7 @@ impl Store { data: ManuallyDrop::new(data), }); - // Note the erasure of the lifetime here into `'static`, so in general - // usage of this trait object must be strictly bounded to the `Store` - // itself, and this is an invariant that we have to maintain throughout - // Wasmtime. - inner.traitobj = StorePtr::new(unsafe { - mem::transmute::< - NonNull, - NonNull, - >(NonNull::from(&mut *inner)) - }); + inner.traitobj = StorePtr::new(NonNull::from(&mut *inner)); // Wasmtime uses the callee argument to host functions to learn about // the original pointer to the `Store` itself, allowing it to diff --git a/crates/wasmtime/src/runtime/store/async_.rs b/crates/wasmtime/src/runtime/store/async_.rs index d1f18a36a659..40d083f46de4 100644 --- a/crates/wasmtime/src/runtime/store/async_.rs +++ b/crates/wasmtime/src/runtime/store/async_.rs @@ -179,7 +179,7 @@ impl<'a, T> StoreContextMut<'a, T> { #[cfg(feature = "gc")] pub async fn gc_async(&mut self, why: Option<&crate::GcHeapOutOfMemory<()>>) -> Result<()> where - T: Send, + T: Send + 'static, { self.0.gc_async(why).await } @@ -720,7 +720,7 @@ impl StoreContextMut<'_, T> { func: impl FnOnce(&mut StoreContextMut<'_, T>) -> R + Send, ) -> Result where - T: Send, + T: Send + 'static, { self.0 .on_fiber(|opaque| { diff --git a/crates/wasmtime/src/runtime/store/context.rs b/crates/wasmtime/src/runtime/store/context.rs index 45d58c30ca99..8b2be535d29f 100644 --- a/crates/wasmtime/src/runtime/store/context.rs +++ b/crates/wasmtime/src/runtime/store/context.rs @@ -8,7 +8,7 @@ use crate::store::{Store, StoreInner}; // representation of this `struct` is a pointer for now. If the representation // changes then the C API will need to be updated #[repr(transparent)] -pub struct StoreContext<'a, T>(pub(crate) &'a StoreInner); +pub struct StoreContext<'a, T: 'static>(pub(crate) &'a StoreInner); /// A temporary handle to a [`&mut Store`][`Store`]. /// @@ -16,7 +16,7 @@ pub struct StoreContext<'a, T>(pub(crate) &'a StoreInner); /// methods if desired. For more information, see [`Store`]. // NB the repr(transparent) here is for the same reason as above. #[repr(transparent)] -pub struct StoreContextMut<'a, T>(pub(crate) &'a mut StoreInner); +pub struct StoreContextMut<'a, T: 'static>(pub(crate) &'a mut StoreInner); /// A trait used to get shared access to a [`Store`] in Wasmtime. /// @@ -33,7 +33,7 @@ pub struct StoreContextMut<'a, T>(pub(crate) &'a mut StoreInner); pub trait AsContext { /// The host information associated with the [`Store`], aka the `T` in /// [`Store`]. - type Data; + type Data: 'static; /// Returns the store context that this type provides access to. fn as_context(&self) -> StoreContext<'_, Self::Data>; @@ -100,7 +100,7 @@ pub trait AsContextMut: AsContext { fn as_context_mut(&mut self) -> StoreContextMut<'_, Self::Data>; } -impl AsContext for Store { +impl AsContext for Store { type Data = T; #[inline] @@ -109,14 +109,14 @@ impl AsContext for Store { } } -impl AsContextMut for Store { +impl AsContextMut for Store { #[inline] fn as_context_mut(&mut self) -> StoreContextMut<'_, T> { StoreContextMut(&mut self.inner) } } -impl AsContext for StoreContext<'_, T> { +impl AsContext for StoreContext<'_, T> { type Data = T; #[inline] @@ -125,7 +125,7 @@ impl AsContext for StoreContext<'_, T> { } } -impl AsContext for StoreContextMut<'_, T> { +impl AsContext for StoreContextMut<'_, T> { type Data = T; #[inline] @@ -134,14 +134,14 @@ impl AsContext for StoreContextMut<'_, T> { } } -impl AsContextMut for StoreContextMut<'_, T> { +impl AsContextMut for StoreContextMut<'_, T> { #[inline] fn as_context_mut(&mut self) -> StoreContextMut<'_, T> { StoreContextMut(&mut *self.0) } } -impl<'a, T> From> for StoreContext<'a, T> { +impl<'a, T: 'static> From> for StoreContext<'a, T> { #[inline] fn from(store: StoreContextMut<'a, T>) -> StoreContext<'a, T> { StoreContext(store.0) @@ -150,7 +150,7 @@ impl<'a, T> From> for StoreContext<'a, T> { // Implementations for internal consumers, but these aren't public types so // they're not publicly accessible for crate consumers. -impl AsContext for &'_ StoreInner { +impl AsContext for &'_ StoreInner { type Data = T; #[inline] @@ -159,7 +159,7 @@ impl AsContext for &'_ StoreInner { } } -impl AsContext for &'_ mut StoreInner { +impl AsContext for &'_ mut StoreInner { type Data = T; #[inline] @@ -168,7 +168,7 @@ impl AsContext for &'_ mut StoreInner { } } -impl AsContextMut for &'_ mut StoreInner { +impl AsContextMut for &'_ mut StoreInner { #[inline] fn as_context_mut(&mut self) -> StoreContextMut<'_, T> { StoreContextMut(&mut **self) diff --git a/crates/wast/src/wast.rs b/crates/wast/src/wast.rs index 7e871b9d2473..5f62b713336e 100644 --- a/crates/wast/src/wast.rs +++ b/crates/wast/src/wast.rs @@ -14,7 +14,7 @@ use wast::{QuoteWat, Wast, WastArg, WastDirective, WastExecute, WastInvoke, Wast /// The wast test script language allows modules to be defined and actions /// to be performed on them. -pub struct WastContext { +pub struct WastContext { /// Wast files have a concept of a "current" module, which is the most /// recently defined. current: Option, diff --git a/crates/wiggle/generate/src/wasmtime.rs b/crates/wiggle/generate/src/wasmtime.rs index cb488f992792..36a2aac6a119 100644 --- a/crates/wiggle/generate/src/wasmtime.rs +++ b/crates/wiggle/generate/src/wasmtime.rs @@ -58,6 +58,7 @@ pub fn link_module( get_cx: impl Fn(&mut T) -> #u + Send + Sync + Copy + 'static, ) -> wiggle::anyhow::Result<()> where + T: 'static, U: #ctx_bound #send_bound { #(#bodies)* diff --git a/crates/wiggle/tests/wasmtime_async.rs b/crates/wiggle/tests/wasmtime_async.rs index 3c309de9c831..07807bc8bdbb 100644 --- a/crates/wiggle/tests/wasmtime_async.rs +++ b/crates/wiggle/tests/wasmtime_async.rs @@ -41,7 +41,7 @@ impl atoms::Atoms for Ctx { #[tokio::test] async fn test_sync_host_func() { let mut store = async_store(); - let mut linker = Linker::new(store.engine()); + let mut linker = Linker::::new(store.engine()); atoms::add_to_linker(&mut linker, |cx| cx).unwrap(); let shim_mod = shim_module(linker.engine()); let shim_inst = linker @@ -67,7 +67,7 @@ async fn test_sync_host_func() { #[tokio::test] async fn test_async_host_func() { let mut store = async_store(); - let mut linker = Linker::new(store.engine()); + let mut linker = Linker::::new(store.engine()); atoms::add_to_linker(&mut linker, |cx| cx).unwrap(); let shim_mod = shim_module(linker.engine()); diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs index 3e2b78513fe6..bd9da493f6ff 100644 --- a/crates/wit-bindgen/src/lib.rs +++ b/crates/wit-bindgen/src/lib.rs @@ -873,12 +873,12 @@ pub fn new<_T>( /// has been created through a [`Linker`]({wt}::component::Linker). /// /// For more information see [`{camel}`] as well. -pub struct {camel}Pre {{ +pub struct {camel}Pre {{ instance_pre: {wt}::component::InstancePre, indices: {camel}Indices, }} -impl Clone for {camel}Pre {{ +impl Clone for {camel}Pre {{ fn clone(&self) -> Self {{ Self {{ instance_pre: self.instance_pre.clone(), @@ -887,7 +887,7 @@ impl Clone for {camel}Pre {{ }} }} -impl<_T> {camel}Pre<_T> {{ +impl<_T: 'static> {camel}Pre<_T> {{ /// Creates a new copy of `{camel}Pre` bindings which can then /// be used to instantiate into a particular store. /// @@ -1532,11 +1532,7 @@ impl Wasmtime { let camel = to_rust_upper_camel_case(&resolve.worlds[world].name); let data_bounds = if self.opts.is_store_data_send() { - if let CallStyle::Concurrent = self.opts.call_style() { - "T: Send + 'static," - } else { - "T: Send," - } + "T: Send," } else { "" }; @@ -1553,7 +1549,7 @@ impl Wasmtime { uwrite!( self.src, " - pub fn add_to_linker_imports_get_host( + pub fn add_to_linker_imports_get_host( linker: &mut {wt}::component::Linker, {options_param} host_getter: G, @@ -1621,10 +1617,7 @@ impl Wasmtime { .collect::>() .concat(); - ( - format!("U: Send{bounds}"), - format!("T: Send{bounds} + 'static,"), - ) + (format!("U: Send{bounds}"), format!("T: Send{bounds},")) } else { ( format!("U: {}", self.world_host_traits(resolve, world).join(" + ")), @@ -1642,6 +1635,7 @@ impl Wasmtime { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> {wt}::Result<()> where + T: 'static, {data_bounds} {host_bounds} {{ @@ -2673,6 +2667,7 @@ impl<'a> InterfaceGenerator<'a> { host_getter: G, ) -> {wt}::Result<()> where + T: 'static, G: for<'a> {wt}::component::GetHost<&'a mut T, Host: {host_bounds}>, {data_bounds} {{ @@ -2711,7 +2706,7 @@ impl<'a> InterfaceGenerator<'a> { get: impl Fn(&mut T) -> &mut U + Send + Sync + Copy + 'static, ) -> {wt}::Result<()> where - U: {host_bounds}, {data_bounds} + T: 'static, U: {host_bounds}, {data_bounds} {{ add_to_linker_get_host(linker {options_arg}, get) }} diff --git a/tests/all/async_functions.rs b/tests/all/async_functions.rs index 6b2e077cbe9c..d872677e6f54 100644 --- a/tests/all/async_functions.rs +++ b/tests/all/async_functions.rs @@ -847,7 +847,7 @@ async fn non_stacky_async_activations() -> Result<()> { let module2 = module2.clone(); let mut store2 = Store::new(caller.engine(), ()); - let mut linker2 = Linker::new(caller.engine()); + let mut linker2 = Linker::<()>::new(caller.engine()); linker2 .func_wrap_async("", "yield", { let stacks = stacks.clone(); @@ -876,7 +876,7 @@ async fn non_stacky_async_activations() -> Result<()> { .await?; capture_stack(&stacks, &store2); - Ok(()) + anyhow::Ok(()) } }) as _) .await @@ -1042,7 +1042,7 @@ async fn async_gc_with_func_new_and_func_wrap() -> Result<()> { "#, )?; - let mut linker = Linker::new(&engine); + let mut linker = Linker::<()>::new(&engine); linker.func_wrap_async("", "a", |mut cx: Caller<'_, _>, ()| { Box::new(async move { let externref = ExternRef::new_async(&mut cx, 100).await?; diff --git a/tests/all/epoch_interruption.rs b/tests/all/epoch_interruption.rs index ced65a08bf03..27e78f856e86 100644 --- a/tests/all/epoch_interruption.rs +++ b/tests/all/epoch_interruption.rs @@ -13,7 +13,7 @@ fn build_engine(config: &mut Config) -> Arc { Arc::new(Engine::new(&config).unwrap()) } -fn make_env(engine: &Engine) -> Linker { +fn make_env(engine: &Engine) -> Linker { let mut linker = Linker::new(engine); let engine = engine.clone(); @@ -53,7 +53,7 @@ async fn run_and_count_yields_or_trap)>( setup_func: F, ) -> Option<(usize, usize)> { let engine = build_engine(config); - let linker = make_env(&engine); + let linker = make_env::(&engine); let module = Module::new(&engine, wasm).unwrap(); let mut store = Store::new(&engine, 0); store.set_epoch_deadline(initial); @@ -457,7 +457,7 @@ async fn drop_future_on_epoch_yield(config: &mut Config) -> Result<()> { "; let engine = build_engine(config); - let mut linker = make_env(&engine); + let mut linker = make_env::<()>(&engine); // Create a few helpers for the Wasm to call. let alive_flag = Arc::new(AtomicBool::new(false)); diff --git a/tests/all/limits.rs b/tests/all/limits.rs index 684d76de35dc..bec830c3e042 100644 --- a/tests/all/limits.rs +++ b/tests/all/limits.rs @@ -868,7 +868,7 @@ async fn custom_limiter_async_detect_grow_failure() -> Result<()> { config.async_support(true); config.allocation_strategy(InstanceAllocationStrategy::Pooling(pool)); let engine = Engine::new(&config).unwrap(); - let linker = Linker::new(&engine); + let linker = Linker::::new(&engine); let module = Module::new( &engine, @@ -1049,7 +1049,7 @@ async fn panic_in_async_memory_limiter() { let mut config = Config::new(); config.async_support(true); let engine = Engine::new(&config).unwrap(); - let linker = Linker::new(&engine); + let linker = Linker::::new(&engine); let module = Module::new(&engine, r#"(module (memory (export "m") 0))"#).unwrap(); @@ -1071,7 +1071,7 @@ async fn panic_in_async_memory_limiter_wasm_stack() { let mut config = Config::new(); config.async_support(true); let engine = Engine::new(&config).unwrap(); - let linker = Linker::new(&engine); + let linker = Linker::::new(&engine); let module = Module::new( &engine, @@ -1101,7 +1101,7 @@ async fn panic_in_async_table_limiter() { let mut config = Config::new(); config.async_support(true); let engine = Engine::new(&config).unwrap(); - let linker = Linker::new(&engine); + let linker = Linker::::new(&engine); let module = Module::new(&engine, r#"(module (table (export "t") 0 funcref))"#).unwrap();