Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 0af418d

Browse files
authored
Merge pull request #159 from bytecodealliance/dicej/async-consolidation
consolidate unsafe code in `concurrent.rs` and friends
2 parents e7bbbd0 + 24193dd commit 0af418d

171 files changed

Lines changed: 3101 additions & 2934 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ authors = ["The Wasmtime Project Developers"]
176176
edition = "2021"
177177
# Wasmtime's current policy is that this number can be no larger than the
178178
# current stable release of Rust minus 2.
179-
rust-version = "1.84.0"
179+
rust-version = "1.85.0"
180180

181181
[workspace.lints.rust]
182182
# Turn on some lints which are otherwise allow-by-default in rustc.

benches/call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ fn wasm_to_host(c: &mut Criterion) {
360360
return;
361361
}
362362

363-
let mut typed = Linker::new(&engine);
363+
let mut typed = Linker::<()>::new(&engine);
364364
typed
365365
.func_wrap_async("", "nop", |caller, _: ()| {
366366
Box::new(async {

crates/component-macro/tests/expanded/char.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
/// has been created through a [`Linker`](wasmtime::component::Linker).
77
///
88
/// For more information see [`TheWorld`] as well.
9-
pub struct TheWorldPre<T> {
9+
pub struct TheWorldPre<T: 'static> {
1010
instance_pre: wasmtime::component::InstancePre<T>,
1111
indices: TheWorldIndices,
1212
}
13-
impl<T> Clone for TheWorldPre<T> {
13+
impl<T: 'static> Clone for TheWorldPre<T> {
1414
fn clone(&self) -> Self {
1515
Self {
1616
instance_pre: self.instance_pre.clone(),
1717
indices: self.indices.clone(),
1818
}
1919
}
2020
}
21-
impl<_T> TheWorldPre<_T> {
21+
impl<_T: 'static> TheWorldPre<_T> {
2222
/// Creates a new copy of `TheWorldPre` bindings which can then
2323
/// be used to instantiate into a particular store.
2424
///
@@ -127,7 +127,7 @@ const _: () = {
127127
impl TheWorld {
128128
/// Convenience wrapper around [`TheWorldPre::new`] and
129129
/// [`TheWorldPre::instantiate`].
130-
pub fn instantiate<_T>(
130+
pub fn instantiate<_T: 'static>(
131131
store: impl wasmtime::AsContextMut<Data = _T>,
132132
component: &wasmtime::component::Component,
133133
linker: &wasmtime::component::Linker<_T>,
@@ -300,7 +300,7 @@ pub mod exports {
300300
arg0: char,
301301
) -> wasmtime::Result<()>
302302
where
303-
<S as wasmtime::AsContext>::Data: Send,
303+
<S as wasmtime::AsContext>::Data: Send + 'static,
304304
{
305305
let callee = unsafe {
306306
wasmtime::component::TypedFunc::<
@@ -318,7 +318,7 @@ pub mod exports {
318318
mut store: S,
319319
) -> wasmtime::Result<char>
320320
where
321-
<S as wasmtime::AsContext>::Data: Send,
321+
<S as wasmtime::AsContext>::Data: Send + 'static,
322322
{
323323
let callee = unsafe {
324324
wasmtime::component::TypedFunc::<

crates/component-macro/tests/expanded/char_async.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
/// has been created through a [`Linker`](wasmtime::component::Linker).
77
///
88
/// For more information see [`TheWorld`] as well.
9-
pub struct TheWorldPre<T> {
9+
pub struct TheWorldPre<T: 'static> {
1010
instance_pre: wasmtime::component::InstancePre<T>,
1111
indices: TheWorldIndices,
1212
}
13-
impl<T> Clone for TheWorldPre<T> {
13+
impl<T: 'static> Clone for TheWorldPre<T> {
1414
fn clone(&self) -> Self {
1515
Self {
1616
instance_pre: self.instance_pre.clone(),
1717
indices: self.indices.clone(),
1818
}
1919
}
2020
}
21-
impl<_T> TheWorldPre<_T> {
21+
impl<_T: 'static> TheWorldPre<_T> {
2222
/// Creates a new copy of `TheWorldPre` bindings which can then
2323
/// be used to instantiate into a particular store.
2424
///
@@ -130,7 +130,7 @@ const _: () = {
130130
impl TheWorld {
131131
/// Convenience wrapper around [`TheWorldPre::new`] and
132132
/// [`TheWorldPre::instantiate_async`].
133-
pub async fn instantiate_async<_T>(
133+
pub async fn instantiate_async<_T: 'static>(
134134
store: impl wasmtime::AsContextMut<Data = _T>,
135135
component: &wasmtime::component::Component,
136136
linker: &wasmtime::component::Linker<_T>,
@@ -311,7 +311,7 @@ pub mod exports {
311311
arg0: char,
312312
) -> wasmtime::Result<()>
313313
where
314-
<S as wasmtime::AsContext>::Data: Send,
314+
<S as wasmtime::AsContext>::Data: Send + 'static,
315315
{
316316
let callee = unsafe {
317317
wasmtime::component::TypedFunc::<
@@ -331,7 +331,7 @@ pub mod exports {
331331
mut store: S,
332332
) -> wasmtime::Result<char>
333333
where
334-
<S as wasmtime::AsContext>::Data: Send,
334+
<S as wasmtime::AsContext>::Data: Send + 'static,
335335
{
336336
let callee = unsafe {
337337
wasmtime::component::TypedFunc::<

crates/component-macro/tests/expanded/char_concurrent.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
/// has been created through a [`Linker`](wasmtime::component::Linker).
77
///
88
/// For more information see [`TheWorld`] as well.
9-
pub struct TheWorldPre<T> {
9+
pub struct TheWorldPre<T: 'static> {
1010
instance_pre: wasmtime::component::InstancePre<T>,
1111
indices: TheWorldIndices,
1212
}
13-
impl<T> Clone for TheWorldPre<T> {
13+
impl<T: 'static> Clone for TheWorldPre<T> {
1414
fn clone(&self) -> Self {
1515
Self {
1616
instance_pre: self.instance_pre.clone(),
1717
indices: self.indices.clone(),
1818
}
1919
}
2020
}
21-
impl<_T> TheWorldPre<_T> {
21+
impl<_T: 'static> TheWorldPre<_T> {
2222
/// Creates a new copy of `TheWorldPre` bindings which can then
2323
/// be used to instantiate into a particular store.
2424
///
@@ -130,7 +130,7 @@ const _: () = {
130130
impl TheWorld {
131131
/// Convenience wrapper around [`TheWorldPre::new`] and
132132
/// [`TheWorldPre::instantiate_async`].
133-
pub async fn instantiate_async<_T>(
133+
pub async fn instantiate_async<_T: 'static>(
134134
store: impl wasmtime::AsContextMut<Data = _T>,
135135
component: &wasmtime::component::Component,
136136
linker: &wasmtime::component::Linker<_T>,
@@ -316,7 +316,7 @@ pub mod exports {
316316
Output = wasmtime::Result<()>,
317317
> + Send + 'static + use<S>
318318
where
319-
<S as wasmtime::AsContext>::Data: Send,
319+
<S as wasmtime::AsContext>::Data: Send + 'static,
320320
{
321321
let callee = unsafe {
322322
wasmtime::component::TypedFunc::<
@@ -334,7 +334,7 @@ pub mod exports {
334334
Output = wasmtime::Result<char>,
335335
> + Send + 'static + use<S>
336336
where
337-
<S as wasmtime::AsContext>::Data: Send,
337+
<S as wasmtime::AsContext>::Data: Send + 'static,
338338
{
339339
let callee = unsafe {
340340
wasmtime::component::TypedFunc::<

crates/component-macro/tests/expanded/char_tracing_async.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
/// has been created through a [`Linker`](wasmtime::component::Linker).
77
///
88
/// For more information see [`TheWorld`] as well.
9-
pub struct TheWorldPre<T> {
9+
pub struct TheWorldPre<T: 'static> {
1010
instance_pre: wasmtime::component::InstancePre<T>,
1111
indices: TheWorldIndices,
1212
}
13-
impl<T> Clone for TheWorldPre<T> {
13+
impl<T: 'static> Clone for TheWorldPre<T> {
1414
fn clone(&self) -> Self {
1515
Self {
1616
instance_pre: self.instance_pre.clone(),
1717
indices: self.indices.clone(),
1818
}
1919
}
2020
}
21-
impl<_T> TheWorldPre<_T> {
21+
impl<_T: 'static> TheWorldPre<_T> {
2222
/// Creates a new copy of `TheWorldPre` bindings which can then
2323
/// be used to instantiate into a particular store.
2424
///
@@ -130,7 +130,7 @@ const _: () = {
130130
impl TheWorld {
131131
/// Convenience wrapper around [`TheWorldPre::new`] and
132132
/// [`TheWorldPre::instantiate_async`].
133-
pub async fn instantiate_async<_T>(
133+
pub async fn instantiate_async<_T: 'static>(
134134
store: impl wasmtime::AsContextMut<Data = _T>,
135135
component: &wasmtime::component::Component,
136136
linker: &wasmtime::component::Linker<_T>,
@@ -340,7 +340,7 @@ pub mod exports {
340340
arg0: char,
341341
) -> wasmtime::Result<()>
342342
where
343-
<S as wasmtime::AsContext>::Data: Send,
343+
<S as wasmtime::AsContext>::Data: Send + 'static,
344344
{
345345
use tracing::Instrument;
346346
let span = tracing::span!(
@@ -369,7 +369,7 @@ pub mod exports {
369369
mut store: S,
370370
) -> wasmtime::Result<char>
371371
where
372-
<S as wasmtime::AsContext>::Data: Send,
372+
<S as wasmtime::AsContext>::Data: Send + 'static,
373373
{
374374
use tracing::Instrument;
375375
let span = tracing::span!(

crates/component-macro/tests/expanded/conventions.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
/// has been created through a [`Linker`](wasmtime::component::Linker).
77
///
88
/// For more information see [`TheWorld`] as well.
9-
pub struct TheWorldPre<T> {
9+
pub struct TheWorldPre<T: 'static> {
1010
instance_pre: wasmtime::component::InstancePre<T>,
1111
indices: TheWorldIndices,
1212
}
13-
impl<T> Clone for TheWorldPre<T> {
13+
impl<T: 'static> Clone for TheWorldPre<T> {
1414
fn clone(&self) -> Self {
1515
Self {
1616
instance_pre: self.instance_pre.clone(),
1717
indices: self.indices.clone(),
1818
}
1919
}
2020
}
21-
impl<_T> TheWorldPre<_T> {
21+
impl<_T: 'static> TheWorldPre<_T> {
2222
/// Creates a new copy of `TheWorldPre` bindings which can then
2323
/// be used to instantiate into a particular store.
2424
///
@@ -129,7 +129,7 @@ const _: () = {
129129
impl TheWorld {
130130
/// Convenience wrapper around [`TheWorldPre::new`] and
131131
/// [`TheWorldPre::instantiate`].
132-
pub fn instantiate<_T>(
132+
pub fn instantiate<_T: 'static>(
133133
store: impl wasmtime::AsContextMut<Data = _T>,
134134
component: &wasmtime::component::Component,
135135
linker: &wasmtime::component::Linker<_T>,
@@ -592,7 +592,7 @@ pub mod exports {
592592
mut store: S,
593593
) -> wasmtime::Result<()>
594594
where
595-
<S as wasmtime::AsContext>::Data: Send,
595+
<S as wasmtime::AsContext>::Data: Send + 'static,
596596
{
597597
let callee = unsafe {
598598
wasmtime::component::TypedFunc::<
@@ -610,7 +610,7 @@ pub mod exports {
610610
arg0: LudicrousSpeed,
611611
) -> wasmtime::Result<()>
612612
where
613-
<S as wasmtime::AsContext>::Data: Send,
613+
<S as wasmtime::AsContext>::Data: Send + 'static,
614614
{
615615
let callee = unsafe {
616616
wasmtime::component::TypedFunc::<
@@ -627,7 +627,7 @@ pub mod exports {
627627
mut store: S,
628628
) -> wasmtime::Result<()>
629629
where
630-
<S as wasmtime::AsContext>::Data: Send,
630+
<S as wasmtime::AsContext>::Data: Send + 'static,
631631
{
632632
let callee = unsafe {
633633
wasmtime::component::TypedFunc::<
@@ -643,7 +643,7 @@ pub mod exports {
643643
S: wasmtime::AsContextMut,
644644
>(&self, mut store: S) -> wasmtime::Result<()>
645645
where
646-
<S as wasmtime::AsContext>::Data: Send,
646+
<S as wasmtime::AsContext>::Data: Send + 'static,
647647
{
648648
let callee = unsafe {
649649
wasmtime::component::TypedFunc::<
@@ -660,7 +660,7 @@ pub mod exports {
660660
mut store: S,
661661
) -> wasmtime::Result<()>
662662
where
663-
<S as wasmtime::AsContext>::Data: Send,
663+
<S as wasmtime::AsContext>::Data: Send + 'static,
664664
{
665665
let callee = unsafe {
666666
wasmtime::component::TypedFunc::<
@@ -677,7 +677,7 @@ pub mod exports {
677677
mut store: S,
678678
) -> wasmtime::Result<()>
679679
where
680-
<S as wasmtime::AsContext>::Data: Send,
680+
<S as wasmtime::AsContext>::Data: Send + 'static,
681681
{
682682
let callee = unsafe {
683683
wasmtime::component::TypedFunc::<
@@ -694,7 +694,7 @@ pub mod exports {
694694
mut store: S,
695695
) -> wasmtime::Result<()>
696696
where
697-
<S as wasmtime::AsContext>::Data: Send,
697+
<S as wasmtime::AsContext>::Data: Send + 'static,
698698
{
699699
let callee = unsafe {
700700
wasmtime::component::TypedFunc::<
@@ -711,7 +711,7 @@ pub mod exports {
711711
mut store: S,
712712
) -> wasmtime::Result<()>
713713
where
714-
<S as wasmtime::AsContext>::Data: Send,
714+
<S as wasmtime::AsContext>::Data: Send + 'static,
715715
{
716716
let callee = unsafe {
717717
wasmtime::component::TypedFunc::<
@@ -733,7 +733,7 @@ pub mod exports {
733733
mut store: S,
734734
) -> wasmtime::Result<()>
735735
where
736-
<S as wasmtime::AsContext>::Data: Send,
736+
<S as wasmtime::AsContext>::Data: Send + 'static,
737737
{
738738
let callee = unsafe {
739739
wasmtime::component::TypedFunc::<
@@ -750,7 +750,7 @@ pub mod exports {
750750
mut store: S,
751751
) -> wasmtime::Result<()>
752752
where
753-
<S as wasmtime::AsContext>::Data: Send,
753+
<S as wasmtime::AsContext>::Data: Send + 'static,
754754
{
755755
let callee = unsafe {
756756
wasmtime::component::TypedFunc::<
@@ -767,7 +767,7 @@ pub mod exports {
767767
mut store: S,
768768
) -> wasmtime::Result<()>
769769
where
770-
<S as wasmtime::AsContext>::Data: Send,
770+
<S as wasmtime::AsContext>::Data: Send + 'static,
771771
{
772772
let callee = unsafe {
773773
wasmtime::component::TypedFunc::<
@@ -785,7 +785,7 @@ pub mod exports {
785785
mut store: S,
786786
) -> wasmtime::Result<()>
787787
where
788-
<S as wasmtime::AsContext>::Data: Send,
788+
<S as wasmtime::AsContext>::Data: Send + 'static,
789789
{
790790
let callee = unsafe {
791791
wasmtime::component::TypedFunc::<

0 commit comments

Comments
 (0)