Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

return `TaskExit` future from `[Typed]Func::call_concurrent` (#11662)

Joel Dicef75ae788ac86
diff --git a/crates/component-macro/tests/expanded/char_concurrent.rs b/crates/component-macro/tests/expanded/char_concurrent.rs
index 9ab7d01e87..ea3ceef044 100644
--- a/crates/component-macro/tests/expanded/char_concurrent.rs
+++ b/crates/component-macro/tests/expanded/char_concurrent.rs
@@ -331,7 +331,7 @@ pub mod exports {
(),
>::new_unchecked(self.take_char)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
/// A function that returns a character
@@ -349,7 +349,7 @@ pub mod exports {
(char,),
>::new_unchecked(self.return_char)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/conventions_concurrent.rs b/crates/component-macro/tests/expanded/conventions_concurrent.rs
index 7f66bf05c6..0e60e76c88 100644
--- a/crates/component-macro/tests/expanded/conventions_concurrent.rs
+++ b/crates/component-macro/tests/expanded/conventions_concurrent.rs
@@ -636,7 +636,7 @@ pub mod exports {
(),
>::new_unchecked(self.kebab_case)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_foo<_T, _D>(
@@ -654,7 +654,7 @@ pub mod exports {
(),
>::new_unchecked(self.foo)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_function_with_dashes<_T, _D>(
@@ -671,7 +671,7 @@ pub mod exports {
(),
>::new_unchecked(self.function_with_dashes)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_function_with_no_weird_characters<_T, _D>(
@@ -688,7 +688,7 @@ pub mod exports {
(),
>::new_unchecked(self.function_with_no_weird_characters)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_apple<_T, _D>(
@@ -705,7 +705,7 @@ pub mod exports {
(),
>::new_unchecked(self.apple)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_apple_pear<_T, _D>(
@@ -722,7 +722,7 @@ pub mod exports {
(),
>::new_unchecked(self.apple_pear)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_apple_pear_grape<_T, _D>(
@@ -739,7 +739,7 @@ pub mod exports {
(),
>::new_unchecked(self.apple_pear_grape)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_a0<_T, _D>(
@@ -756,7 +756,7 @@ pub mod exports {
(),
>::new_unchecked(self.a0)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
/// Comment out identifiers that collide when mapped to snake_case, for now; see
@@ -778,7 +778,7 @@ pub mod exports {
(),
>::new_unchecked(self.is_xml)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_explicit<_T, _D>(
@@ -795,7 +795,7 @@ pub mod exports {
(),
>::new_unchecked(self.explicit)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_explicit_kebab<_T, _D>(
@@ -812,7 +812,7 @@ pub mod exports {
(),
>::new_unchecked(self.explicit_kebab)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
/// Identifiers with the same name as keywords are quoted.
@@ -830,7 +830,7 @@ pub mod exports {
(),
>::new_unchecked(self.bool)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
}
diff --git a/crates/component-macro/tests/expanded/flags_concurrent.rs b/crates/component-macro/tests/expanded/flags_concurrent.rs
index 7a7b1c7d67..1b05307e72 100644
--- a/crates/component-macro/tests/expanded/flags_concurrent.rs
+++ b/crates/component-macro/tests/expanded/flags_concurrent.rs
@@ -730,7 +730,7 @@ pub mod exports {
(Flag1,),
>::new_unchecked(self.roundtrip_flag1)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_roundtrip_flag2<_T, _D>(
@@ -748,7 +748,7 @@ pub mod exports {
(Flag2,),
>::new_unchecked(self.roundtrip_flag2)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_roundtrip_flag4<_T, _D>(
@@ -766,7 +766,7 @@ pub mod exports {
(Flag4,),
>::new_unchecked(self.roundtrip_flag4)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_roundtrip_flag8<_T, _D>(
@@ -784,7 +784,7 @@ pub mod exports {
(Flag8,),
>::new_unchecked(self.roundtrip_flag8)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_roundtrip_flag16<_T, _D>(
@@ -802,7 +802,7 @@ pub mod exports {
(Flag16,),
>::new_unchecked(self.roundtrip_flag16)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_roundtrip_flag32<_T, _D>(
@@ -820,7 +820,7 @@ pub mod exports {
(Flag32,),
>::new_unchecked(self.roundtrip_flag32)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_roundtrip_flag64<_T, _D>(
@@ -838,7 +838,7 @@ pub mod exports {
(Flag64,),
>::new_unchecked(self.roundtrip_flag64)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/floats_concurrent.rs b/crates/component-macro/tests/expanded/floats_concurrent.rs
index d28e30d77d..5cb418d161 100644
--- a/crates/component-macro/tests/expanded/floats_concurrent.rs
+++ b/crates/component-macro/tests/expanded/floats_concurrent.rs
@@ -373,7 +373,7 @@ pub mod exports {
(),
>::new_unchecked(self.f32_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_f64_param<_T, _D>(
@@ -391,7 +391,7 @@ pub mod exports {
(),
>::new_unchecked(self.f64_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_f32_result<_T, _D>(
@@ -408,7 +408,7 @@ pub mod exports {
(f32,),
>::new_unchecked(self.f32_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_f64_result<_T, _D>(
@@ -425,7 +425,7 @@ pub mod exports {
(f64,),
>::new_unchecked(self.f64_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/function-new_concurrent.rs b/crates/component-macro/tests/expanded/function-new_concurrent.rs
index 5d82a32c69..fed856aaa1 100644
--- a/crates/component-macro/tests/expanded/function-new_concurrent.rs
+++ b/crates/component-macro/tests/expanded/function-new_concurrent.rs
@@ -193,7 +193,7 @@ const _: () = {
let callee = unsafe {
wasmtime::component::TypedFunc::<(), ()>::new_unchecked(self.new)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
}
diff --git a/crates/component-macro/tests/expanded/integers_concurrent.rs b/crates/component-macro/tests/expanded/integers_concurrent.rs
index 007f27f031..07c56e472d 100644
--- a/crates/component-macro/tests/expanded/integers_concurrent.rs
+++ b/crates/component-macro/tests/expanded/integers_concurrent.rs
@@ -710,7 +710,7 @@ pub mod exports {
(),
>::new_unchecked(self.a1)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a2<_T, _D>(
@@ -728,7 +728,7 @@ pub mod exports {
(),
>::new_unchecked(self.a2)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a3<_T, _D>(
@@ -746,7 +746,7 @@ pub mod exports {
(),
>::new_unchecked(self.a3)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a4<_T, _D>(
@@ -764,7 +764,7 @@ pub mod exports {
(),
>::new_unchecked(self.a4)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a5<_T, _D>(
@@ -782,7 +782,7 @@ pub mod exports {
(),
>::new_unchecked(self.a5)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a6<_T, _D>(
@@ -800,7 +800,7 @@ pub mod exports {
(),
>::new_unchecked(self.a6)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a7<_T, _D>(
@@ -818,7 +818,7 @@ pub mod exports {
(),
>::new_unchecked(self.a7)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a8<_T, _D>(
@@ -836,7 +836,7 @@ pub mod exports {
(),
>::new_unchecked(self.a8)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_a9<_T, _D>(
@@ -866,7 +866,8 @@ pub mod exports {
accessor,
(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7),
)
- .await?;
+ .await?
+ .0;
Ok(())
}
pub async fn call_r1<_T, _D>(
@@ -883,7 +884,7 @@ pub mod exports {
(u8,),
>::new_unchecked(self.r1)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_r2<_T, _D>(
@@ -900,7 +901,7 @@ pub mod exports {
(i8,),
>::new_unchecked(self.r2)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_r3<_T, _D>(
@@ -917,7 +918,7 @@ pub mod exports {
(u16,),
>::new_unchecked(self.r3)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_r4<_T, _D>(
@@ -934,7 +935,7 @@ pub mod exports {
(i16,),
>::new_unchecked(self.r4)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_r5<_T, _D>(
@@ -951,7 +952,7 @@ pub mod exports {
(u32,),
>::new_unchecked(self.r5)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_r6<_T, _D>(
@@ -968,7 +969,7 @@ pub mod exports {
(i32,),
>::new_unchecked(self.r6)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_r7<_T, _D>(
@@ -985,7 +986,7 @@ pub mod exports {
(u64,),
>::new_unchecked(self.r7)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_r8<_T, _D>(
@@ -1002,7 +1003,7 @@ pub mod exports {
(i64,),
>::new_unchecked(self.r8)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_pair_ret<_T, _D>(
@@ -1019,7 +1020,7 @@ pub mod exports {
((i64, u8),),
>::new_unchecked(self.pair_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/lists_concurrent.rs b/crates/component-macro/tests/expanded/lists_concurrent.rs
index efb822593a..75653fdd63 100644
--- a/crates/component-macro/tests/expanded/lists_concurrent.rs
+++ b/crates/component-macro/tests/expanded/lists_concurrent.rs
@@ -1526,7 +1526,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_u8_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_u16_param<_T, _D>(
@@ -1544,7 +1544,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_u16_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_u32_param<_T, _D>(
@@ -1562,7 +1562,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_u32_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_u64_param<_T, _D>(
@@ -1580,7 +1580,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_u64_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_s8_param<_T, _D>(
@@ -1598,7 +1598,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_s8_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_s16_param<_T, _D>(
@@ -1616,7 +1616,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_s16_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_s32_param<_T, _D>(
@@ -1634,7 +1634,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_s32_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_s64_param<_T, _D>(
@@ -1652,7 +1652,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_s64_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_f32_param<_T, _D>(
@@ -1670,7 +1670,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_f32_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_f64_param<_T, _D>(
@@ -1688,7 +1688,7 @@ pub mod exports {
(),
>::new_unchecked(self.list_f64_param)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_list_u8_ret<_T, _D>(
@@ -1705,7 +1705,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<u8>,),
>::new_unchecked(self.list_u8_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_u16_ret<_T, _D>(
@@ -1722,7 +1722,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<u16>,),
>::new_unchecked(self.list_u16_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_u32_ret<_T, _D>(
@@ -1739,7 +1739,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<u32>,),
>::new_unchecked(self.list_u32_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_u64_ret<_T, _D>(
@@ -1756,7 +1756,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<u64>,),
>::new_unchecked(self.list_u64_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_s8_ret<_T, _D>(
@@ -1773,7 +1773,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<i8>,),
>::new_unchecked(self.list_s8_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_s16_ret<_T, _D>(
@@ -1790,7 +1790,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<i16>,),
>::new_unchecked(self.list_s16_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_s32_ret<_T, _D>(
@@ -1807,7 +1807,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<i32>,),
>::new_unchecked(self.list_s32_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_s64_ret<_T, _D>(
@@ -1824,7 +1824,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<i64>,),
>::new_unchecked(self.list_s64_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_f32_ret<_T, _D>(
@@ -1841,7 +1841,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<f32>,),
>::new_unchecked(self.list_f32_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_list_f64_ret<_T, _D>(
@@ -1858,7 +1858,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<f64>,),
>::new_unchecked(self.list_f64_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_tuple_list<_T, _D>(
@@ -1878,7 +1878,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<(i64, u32)>,),
>::new_unchecked(self.tuple_list)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_string_list_arg<_T, _D>(
@@ -1902,7 +1902,7 @@ pub mod exports {
(),
>::new_unchecked(self.string_list_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_string_list_ret<_T, _D>(
@@ -1927,7 +1927,7 @@ pub mod exports {
),
>::new_unchecked(self.string_list_ret)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_tuple_string_list<_T, _D>(
@@ -1959,7 +1959,7 @@ pub mod exports {
),
>::new_unchecked(self.tuple_string_list)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_string_list<_T, _D>(
@@ -1991,7 +1991,7 @@ pub mod exports {
),
>::new_unchecked(self.string_list)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_record_list<_T, _D>(
@@ -2011,7 +2011,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<OtherRecord>,),
>::new_unchecked(self.record_list)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_record_list_reverse<_T, _D>(
@@ -2031,7 +2031,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<SomeRecord>,),
>::new_unchecked(self.record_list_reverse)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_variant_list<_T, _D>(
@@ -2051,7 +2051,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<OtherVariant>,),
>::new_unchecked(self.variant_list)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_load_store_everything<_T, _D>(
@@ -2069,7 +2069,7 @@ pub mod exports {
(LoadStoreAllSizes,),
>::new_unchecked(self.load_store_everything)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/many-arguments_concurrent.rs b/crates/component-macro/tests/expanded/many-arguments_concurrent.rs
index 7a8f2cdacc..ca8ef03ff0 100644
--- a/crates/component-macro/tests/expanded/many-arguments_concurrent.rs
+++ b/crates/component-macro/tests/expanded/many-arguments_concurrent.rs
@@ -645,7 +645,8 @@ pub mod exports {
arg15,
),
)
- .await?;
+ .await?
+ .0;
Ok(())
}
pub async fn call_big_argument<_T, _D>(
@@ -663,7 +664,7 @@ pub mod exports {
(),
>::new_unchecked(self.big_argument)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
}
diff --git a/crates/component-macro/tests/expanded/multiversion_concurrent.rs b/crates/component-macro/tests/expanded/multiversion_concurrent.rs
index 0c92547a9d..388410b32b 100644
--- a/crates/component-macro/tests/expanded/multiversion_concurrent.rs
+++ b/crates/component-macro/tests/expanded/multiversion_concurrent.rs
@@ -348,7 +348,7 @@ pub mod exports {
(),
>::new_unchecked(self.x)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
}
@@ -430,7 +430,7 @@ pub mod exports {
(),
>::new_unchecked(self.x)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
}
diff --git a/crates/component-macro/tests/expanded/records_concurrent.rs b/crates/component-macro/tests/expanded/records_concurrent.rs
index 410dce8b0b..0ab61e1cef 100644
--- a/crates/component-macro/tests/expanded/records_concurrent.rs
+++ b/crates/component-macro/tests/expanded/records_concurrent.rs
@@ -910,7 +910,7 @@ pub mod exports {
(),
>::new_unchecked(self.tuple_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_tuple_result<_T, _D>(
@@ -927,7 +927,7 @@ pub mod exports {
((char, u32),),
>::new_unchecked(self.tuple_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_empty_arg<_T, _D>(
@@ -945,7 +945,7 @@ pub mod exports {
(),
>::new_unchecked(self.empty_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_empty_result<_T, _D>(
@@ -962,7 +962,7 @@ pub mod exports {
(Empty,),
>::new_unchecked(self.empty_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_scalar_arg<_T, _D>(
@@ -980,7 +980,7 @@ pub mod exports {
(),
>::new_unchecked(self.scalar_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_scalar_result<_T, _D>(
@@ -997,7 +997,7 @@ pub mod exports {
(Scalars,),
>::new_unchecked(self.scalar_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_flags_arg<_T, _D>(
@@ -1015,7 +1015,7 @@ pub mod exports {
(),
>::new_unchecked(self.flags_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_flags_result<_T, _D>(
@@ -1032,7 +1032,7 @@ pub mod exports {
(ReallyFlags,),
>::new_unchecked(self.flags_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_aggregate_arg<_T, _D>(
@@ -1050,7 +1050,7 @@ pub mod exports {
(),
>::new_unchecked(self.aggregate_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_aggregate_result<_T, _D>(
@@ -1067,7 +1067,7 @@ pub mod exports {
(Aggregates,),
>::new_unchecked(self.aggregate_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_typedef_inout<_T, _D>(
@@ -1085,7 +1085,7 @@ pub mod exports {
(i32,),
>::new_unchecked(self.typedef_inout)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/resources-export_concurrent.rs b/crates/component-macro/tests/expanded/resources-export_concurrent.rs
index 6caea2f186..775fb22e23 100644
--- a/crates/component-macro/tests/expanded/resources-export_concurrent.rs
+++ b/crates/component-macro/tests/expanded/resources-export_concurrent.rs
@@ -399,7 +399,7 @@ pub mod exports {
(wasmtime::component::ResourceAny,),
>::new_unchecked(self.funcs.constructor_a_constructor)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_static_a<_T, _D>(
@@ -416,7 +416,7 @@ pub mod exports {
(u32,),
>::new_unchecked(self.funcs.static_a_static_a)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_method_a<_T, _D>(
@@ -434,7 +434,7 @@ pub mod exports {
(u32,),
>::new_unchecked(self.funcs.method_a_method_a)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
}
@@ -557,7 +557,7 @@ pub mod exports {
(wasmtime::component::ResourceAny,),
>::new_unchecked(self.funcs.constructor_a_constructor)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
pub async fn call_static_a<_T, _D>(
@@ -574,7 +574,7 @@ pub mod exports {
(wasmtime::component::Resource<Y>,),
>::new_unchecked(self.funcs.static_a_static_a)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_method_a<_T, _D>(
@@ -598,7 +598,8 @@ pub mod exports {
};
let (ret0,) = callee
.call_concurrent(accessor, (arg0, arg1))
- .await?;
+ .await?
+ .0;
Ok(ret0)
}
}
@@ -692,7 +693,7 @@ pub mod exports {
(wasmtime::component::ResourceAny,),
>::new_unchecked(self.funcs.constructor_a_constructor)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
}
@@ -788,7 +789,7 @@ pub mod exports {
(wasmtime::component::ResourceAny,),
>::new_unchecked(self.funcs.constructor_b_constructor)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/resources-import_concurrent.rs b/crates/component-macro/tests/expanded/resources-import_concurrent.rs
index d9f4e769b5..5462bf1d22 100644
--- a/crates/component-macro/tests/expanded/resources-import_concurrent.rs
+++ b/crates/component-macro/tests/expanded/resources-import_concurrent.rs
@@ -369,7 +369,7 @@ const _: () = {
(wasmtime::component::Resource<WorldResource>,),
>::new_unchecked(self.some_world_func2)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub fn foo_foo_uses_resource_transitively(
@@ -1182,7 +1182,7 @@ pub mod exports {
(),
>::new_unchecked(self.handle)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
}
diff --git a/crates/component-macro/tests/expanded/share-types_concurrent.rs b/crates/component-macro/tests/expanded/share-types_concurrent.rs
index 89badb4092..377f2564fb 100644
--- a/crates/component-macro/tests/expanded/share-types_concurrent.rs
+++ b/crates/component-macro/tests/expanded/share-types_concurrent.rs
@@ -385,7 +385,7 @@ pub mod exports {
(Response,),
>::new_unchecked(self.handle_request)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/simple-functions_concurrent.rs b/crates/component-macro/tests/expanded/simple-functions_concurrent.rs
index 819ed70b8c..b526db189a 100644
--- a/crates/component-macro/tests/expanded/simple-functions_concurrent.rs
+++ b/crates/component-macro/tests/expanded/simple-functions_concurrent.rs
@@ -421,7 +421,7 @@ pub mod exports {
(),
>::new_unchecked(self.f1)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
pub async fn call_f2<_T, _D>(
@@ -439,7 +439,7 @@ pub mod exports {
(),
>::new_unchecked(self.f2)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_f3<_T, _D>(
@@ -458,7 +458,7 @@ pub mod exports {
(),
>::new_unchecked(self.f3)
};
- let () = callee.call_concurrent(accessor, (arg0, arg1)).await?;
+ let () = callee.call_concurrent(accessor, (arg0, arg1)).await?.0;
Ok(())
}
pub async fn call_f4<_T, _D>(
@@ -475,7 +475,7 @@ pub mod exports {
(u32,),
>::new_unchecked(self.f4)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_f5<_T, _D>(
@@ -492,7 +492,7 @@ pub mod exports {
((u32, u32),),
>::new_unchecked(self.f5)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_f6<_T, _D>(
@@ -514,7 +514,8 @@ pub mod exports {
};
let (ret0,) = callee
.call_concurrent(accessor, (arg0, arg1, arg2))
- .await?;
+ .await?
+ .0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/simple-lists_concurrent.rs b/crates/component-macro/tests/expanded/simple-lists_concurrent.rs
index 6ceff3286b..9a1879dfa1 100644
--- a/crates/component-macro/tests/expanded/simple-lists_concurrent.rs
+++ b/crates/component-macro/tests/expanded/simple-lists_concurrent.rs
@@ -431,7 +431,7 @@ pub mod exports {
(),
>::new_unchecked(self.simple_list1)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_simple_list2<_T, _D>(
@@ -448,7 +448,7 @@ pub mod exports {
(wasmtime::component::__internal::Vec<u32>,),
>::new_unchecked(self.simple_list2)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_simple_list3<_T, _D>(
@@ -482,7 +482,8 @@ pub mod exports {
};
let (ret0,) = callee
.call_concurrent(accessor, (arg0, arg1))
- .await?;
+ .await?
+ .0;
Ok(ret0)
}
pub async fn call_simple_list4<_T, _D>(
@@ -514,7 +515,7 @@ pub mod exports {
),
>::new_unchecked(self.simple_list4)
};
- let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
+ let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs b/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs
index 7d35bc918a..5cebde393d 100644
--- a/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs
+++ b/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs
@@ -419,7 +419,7 @@ pub mod exports {
),
>::new_unchecked(self.option_test)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/smoke-default_concurrent.rs b/crates/component-macro/tests/expanded/smoke-default_concurrent.rs
index 3de50eb724..2f2126b272 100644
--- a/crates/component-macro/tests/expanded/smoke-default_concurrent.rs
+++ b/crates/component-macro/tests/expanded/smoke-default_concurrent.rs
@@ -193,7 +193,7 @@ const _: () = {
let callee = unsafe {
wasmtime::component::TypedFunc::<(), ()>::new_unchecked(self.y)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
}
diff --git a/crates/component-macro/tests/expanded/smoke-export_concurrent.rs b/crates/component-macro/tests/expanded/smoke-export_concurrent.rs
index f6c352a9b9..36186bf9d2 100644
--- a/crates/component-macro/tests/expanded/smoke-export_concurrent.rs
+++ b/crates/component-macro/tests/expanded/smoke-export_concurrent.rs
@@ -242,7 +242,7 @@ pub mod exports {
let callee = unsafe {
wasmtime::component::TypedFunc::<(), ()>::new_unchecked(self.y)
};
- let () = callee.call_concurrent(accessor, ()).await?;
+ let () = callee.call_concurrent(accessor, ()).await?.0;
Ok(())
}
}
diff --git a/crates/component-macro/tests/expanded/strings_concurrent.rs b/crates/component-macro/tests/expanded/strings_concurrent.rs
index d7575f41ac..5b099851ab 100644
--- a/crates/component-macro/tests/expanded/strings_concurrent.rs
+++ b/crates/component-macro/tests/expanded/strings_concurrent.rs
@@ -367,7 +367,7 @@ pub mod exports {
(),
>::new_unchecked(self.a)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_b<_T, _D>(
@@ -384,7 +384,7 @@ pub mod exports {
(wasmtime::component::__internal::String,),
>::new_unchecked(self.b)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_c<_T, _D>(
@@ -408,7 +408,8 @@ pub mod exports {
};
let (ret0,) = callee
.call_concurrent(accessor, (arg0, arg1))
- .await?;
+ .await?
+ .0;
Ok(ret0)
}
}
diff --git a/crates/component-macro/tests/expanded/variants_concurrent.rs b/crates/component-macro/tests/expanded/variants_concurrent.rs
index d691d58dec..2dbb27aad2 100644
--- a/crates/component-macro/tests/expanded/variants_concurrent.rs
+++ b/crates/component-macro/tests/expanded/variants_concurrent.rs
@@ -1538,7 +1538,7 @@ pub mod exports {
(),
>::new_unchecked(self.e1_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_e1_result<_T, _D>(
@@ -1555,7 +1555,7 @@ pub mod exports {
(E1,),
>::new_unchecked(self.e1_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_v1_arg<_T, _D>(
@@ -1573,7 +1573,7 @@ pub mod exports {
(),
>::new_unchecked(self.v1_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_v1_result<_T, _D>(
@@ -1590,7 +1590,7 @@ pub mod exports {
(V1,),
>::new_unchecked(self.v1_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_bool_arg<_T, _D>(
@@ -1608,7 +1608,7 @@ pub mod exports {
(),
>::new_unchecked(self.bool_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_bool_result<_T, _D>(
@@ -1625,7 +1625,7 @@ pub mod exports {
(bool,),
>::new_unchecked(self.bool_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_option_arg<_T, _D>(
@@ -1660,7 +1660,8 @@ pub mod exports {
accessor,
(arg0, arg1, arg2, arg3, arg4, arg5),
)
- .await?;
+ .await?
+ .0;
Ok(())
}
pub async fn call_option_result<_T, _D>(
@@ -1695,7 +1696,7 @@ pub mod exports {
),
>::new_unchecked(self.option_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_casts<_T, _D>(
@@ -1725,7 +1726,8 @@ pub mod exports {
accessor,
(arg0, arg1, arg2, arg3, arg4, arg5),
)
- .await?;
+ .await?
+ .0;
Ok(ret0)
}
pub async fn call_result_arg<_T, _D>(
@@ -1766,7 +1768,8 @@ pub mod exports {
accessor,
(arg0, arg1, arg2, arg3, arg4, arg5),
)
- .await?;
+ .await?
+ .0;
Ok(())
}
pub async fn call_result_result<_T, _D>(
@@ -1807,7 +1810,7 @@ pub mod exports {
),
>::new_unchecked(self.result_result)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_return_result_sugar<_T, _D>(
@@ -1824,7 +1827,7 @@ pub mod exports {
(Result<i32, MyErrno>,),
>::new_unchecked(self.return_result_sugar)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_return_result_sugar2<_T, _D>(
@@ -1841,7 +1844,7 @@ pub mod exports {
(Result<(), MyErrno>,),
>::new_unchecked(self.return_result_sugar2)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_return_result_sugar3<_T, _D>(
@@ -1858,7 +1861,7 @@ pub mod exports {
(Result<MyErrno, MyErrno>,),
>::new_unchecked(self.return_result_sugar3)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_return_result_sugar4<_T, _D>(
@@ -1875,7 +1878,7 @@ pub mod exports {
(Result<(i32, u32), MyErrno>,),
>::new_unchecked(self.return_result_sugar4)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_return_option_sugar<_T, _D>(
@@ -1892,7 +1895,7 @@ pub mod exports {
(Option<i32>,),
>::new_unchecked(self.return_option_sugar)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_return_option_sugar2<_T, _D>(
@@ -1909,7 +1912,7 @@ pub mod exports {
(Option<MyErrno>,),
>::new_unchecked(self.return_option_sugar2)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_result_simple<_T, _D>(
@@ -1926,7 +1929,7 @@ pub mod exports {
(Result<u32, i32>,),
>::new_unchecked(self.result_simple)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
pub async fn call_is_clone_arg<_T, _D>(
@@ -1944,7 +1947,7 @@ pub mod exports {
(),
>::new_unchecked(self.is_clone_arg)
};
- let () = callee.call_concurrent(accessor, (arg0,)).await?;
+ let () = callee.call_concurrent(accessor, (arg0,)).await?.0;
Ok(())
}
pub async fn call_is_clone_return<_T, _D>(
@@ -1961,7 +1964,7 @@ pub mod exports {
(IsClone,),
>::new_unchecked(self.is_clone_return)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
}
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 64ab96eddc..5eeb65e9c4 100644
--- a/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs
+++ b/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs
@@ -232,7 +232,7 @@ const _: () = {
let callee = unsafe {
wasmtime::component::TypedFunc::<(), ((T, U, R),)>::new_unchecked(self.f)
};
- let (ret0,) = callee.call_concurrent(accessor, ()).await?;
+ let (ret0,) = callee.call_concurrent(accessor, ()).await?.0;
Ok(ret0)
}
}
diff --git a/crates/misc/component-async-tests/tests/scenario/post_return.rs b/crates/misc/component-async-tests/tests/scenario/post_return.rs
index 702f7fb96c..0685d17401 100644
--- a/crates/misc/component-async-tests/tests/scenario/post_return.rs
+++ b/crates/misc/component-async-tests/tests/scenario/post_return.rs
@@ -1,6 +1,11 @@
-use anyhow::Result;
-
use super::util::test_run;
+use crate::scenario::util::{config, make_component};
+use anyhow::{Result, anyhow};
+use component_async_tests::{Ctx, sleep};
+use std::sync::{Arc, Mutex};
+use wasmtime::component::{Linker, ResourceTable};
+use wasmtime::{Engine, Store};
+use wasmtime_wasi::WasiCtxBuilder;
// No-op function; we only test this by composing it in `async_post_return_caller`
#[allow(
@@ -17,3 +22,66 @@ pub async fn async_post_return_caller() -> Result<()> {
])
.await
}
+
+#[tokio::test]
+pub async fn async_sleep_post_return_caller() -> Result<()> {
+ test_sleep_post_return(&[
+ test_programs_artifacts::ASYNC_SLEEP_POST_RETURN_CALLER_COMPONENT,
+ test_programs_artifacts::ASYNC_SLEEP_POST_RETURN_CALLEE_COMPONENT,
+ ])
+ .await
+}
+
+#[tokio::test]
+pub async fn async_sleep_post_return_callee() -> Result<()> {
+ test_sleep_post_return(&[test_programs_artifacts::ASYNC_SLEEP_POST_RETURN_CALLEE_COMPONENT])
+ .await
+}
+
+async fn test_sleep_post_return(components: &[&str]) -> Result<()> {
+ let engine = Engine::new(&config())?;
+
+ let component = make_component(&engine, components).await?;
+
+ let mut linker = Linker::new(&engine);
+
+ wasmtime_wasi::p2::add_to_linker_async(&mut linker)?;
+ sleep::local::local::sleep::add_to_linker::<_, Ctx>(&mut linker, |ctx| ctx)?;
+
+ let mut store = Store::new(
+ &engine,
+ Ctx {
+ wasi: WasiCtxBuilder::new().inherit_stdio().build(),
+ table: ResourceTable::default(),
+ continue_: false,
+ wakers: Arc::new(Mutex::new(None)),
+ },
+ );
+
+ let instance = linker.instantiate_async(&mut store, &component).await?;
+ // TODO: Update the following to use generated bindings once
+ // `wasmtime-wit-bindgen` has an option to expose the `TaskExit` return
+ // value from `[Typed]Func::call_concurrent`.
+ let sleep_post_return_instance = instance
+ .get_export_index(&mut store, None, "local:local/sleep-post-return")
+ .ok_or_else(|| anyhow!("can't find `local:local/sleep-post-return` in instance"))?;
+ let run_function = instance
+ .get_export_index(&mut store, Some(&sleep_post_return_instance), "[async]run")
+ .ok_or_else(|| anyhow!("can't find `[async]run` in instance"))?;
+ let run_function = instance.get_typed_func::<(u64,), ()>(&mut store, run_function)?;
+ instance
+ .run_concurrent(&mut store, async |accessor| {
+ // This function should return immediately, then sleep the specified
+ // number of milliseconds after returning, and then finally exit.
+ let exit = run_function.call_concurrent(accessor, (100,)).await?.1;
+ // The function has returned, now we wait for it (and any subtasks
+ // it may have spawned) to exit.
+ exit.block(accessor).await;
+ anyhow::Ok(())
+ })
+ .await??;
+ // At this point, all subtasks should have exited, meaning no waitables,
+ // tasks, or other concurrent state should remain present in the instance.
+ instance.assert_concurrent_state_empty(&mut store);
+ Ok(())
+}
diff --git a/crates/misc/component-async-tests/tests/scenario/round_trip.rs b/crates/misc/component-async-tests/tests/scenario/round_trip.rs
index 8408575127..c641ee5166 100644
--- a/crates/misc/component-async-tests/tests/scenario/round_trip.rs
+++ b/crates/misc/component-async-tests/tests/scenario/round_trip.rs
@@ -376,10 +376,10 @@ pub async fn test_round_trip(
.ok_or_else(|| anyhow!("can't find `local:local/baz` in instance"))?;
let foo_function = instance
.get_export_index(&mut store, Some(&baz_instance), "[async]foo")
- .ok_or_else(|| anyhow!("can't find `foo` in instance"))?;
+ .ok_or_else(|| anyhow!("can't find `[async]foo` in instance"))?;
let foo_function = instance
.get_func(&mut store, foo_function)
- .ok_or_else(|| anyhow!("can't find `foo` in instance"))?;
+ .ok_or_else(|| anyhow!("can't find `[async]foo` in instance"))?;
if call_style == 3 || !cfg!(miri) {
instance
diff --git a/crates/misc/component-async-tests/tests/test_all.rs b/crates/misc/component-async-tests/tests/test_all.rs
index 93ebbe3238..833983ba39 100644
--- a/crates/misc/component-async-tests/tests/test_all.rs
+++ b/crates/misc/component-async-tests/tests/test_all.rs
@@ -16,7 +16,10 @@ use scenario::borrowing::{async_borrowing_callee, async_borrowing_caller};
use scenario::error_context::{
async_error_context, async_error_context_callee, async_error_context_caller,
};
-use scenario::post_return::{async_post_return_callee, async_post_return_caller};
+use scenario::post_return::{
+ async_post_return_callee, async_post_return_caller, async_sleep_post_return_callee,
+ async_sleep_post_return_caller,
+};
use scenario::read_resource_stream::async_read_resource_stream;
use scenario::round_trip::{
async_round_trip_stackful, async_round_trip_stackless, async_round_trip_stackless_sync_import,
diff --git a/crates/misc/component-async-tests/wit/test.wit b/crates/misc/component-async-tests/wit/test.wit
index 700f8c83c2..41488a8125 100644
--- a/crates/misc/component-async-tests/wit/test.wit
+++ b/crates/misc/component-async-tests/wit/test.wit
@@ -170,6 +170,10 @@ interface synchronous-transmit {
start: async func(s: stream<u8>, s-expected: list<u8>, f: future<u8>, f-expected: u8) -> tuple<stream<u8>, list<u8>, future<u8>, u8>;
}
+interface sleep-post-return {
+ run: async func(sleep-time-millis: u64);
+}
+
world yield-caller {
import continue;
import ready;
@@ -323,3 +327,14 @@ world readiness-guest {
world synchronous-transmit-guest {
export synchronous-transmit;
}
+
+world sleep-post-return-callee {
+ import sleep;
+ export sleep-post-return;
+}
+
+world sleep-post-return-caller {
+ import sleep;
+ import sleep-post-return;
+ export sleep-post-return;
+}
diff --git a/crates/test-programs/src/bin/async_sleep_post_return_callee.rs b/crates/test-programs/src/bin/async_sleep_post_return_callee.rs
new file mode 100644
index 0000000000..82c0d60bb6
--- /dev/null
+++ b/crates/test-programs/src/bin/async_sleep_post_return_callee.rs
@@ -0,0 +1,29 @@
+mod bindings {
+ wit_bindgen::generate!({
+ path: "../misc/component-async-tests/wit",
+ world: "sleep-post-return-caller",
+ });
+
+ use super::Component;
+ export!(Component);
+}
+
+use {
+ bindings::{exports::local::local::sleep_post_return::Guest, local::local::sleep},
+ wit_bindgen::rt::async_support,
+};
+
+struct Component;
+
+impl Guest for Component {
+ async fn run(sleep_time_millis: u64) {
+ // Spawn a task to run post-return and otherwise return immediately.
+ async_support::spawn(async move {
+ // Sleep for as long as requested:
+ sleep::sleep_millis(sleep_time_millis).await;
+ });
+ }
+}
+
+// Unused function; required since this file is built as a `bin`:
+fn main() {}
diff --git a/crates/test-programs/src/bin/async_sleep_post_return_caller.rs b/crates/test-programs/src/bin/async_sleep_post_return_caller.rs
new file mode 100644
index 0000000000..2866212c05
--- /dev/null
+++ b/crates/test-programs/src/bin/async_sleep_post_return_caller.rs
@@ -0,0 +1,37 @@
+mod bindings {
+ wit_bindgen::generate!({
+ path: "../misc/component-async-tests/wit",
+ world: "sleep-post-return-caller",
+ });
+
+ use super::Component;
+ export!(Component);
+}
+
+use {
+ bindings::{
+ exports::local::local::sleep_post_return::Guest,
+ local::local::{sleep, sleep_post_return},
+ },
+ wit_bindgen::rt::async_support,
+};
+
+struct Component;
+
+impl Guest for Component {
+ async fn run(sleep_time_millis: u64) {
+ // Spawn a task to run post-return and otherwise return immediately.
+ async_support::spawn(async move {
+ // Create a couple of subtasks which will also return immediately
+ // and sleep post-return. These will not have completed once we
+ // exit and thus will be reparented to the caller.
+ sleep_post_return::run(sleep_time_millis * 2).await;
+ sleep_post_return::run(sleep_time_millis * 2).await;
+ // Sleep for as long as requested:
+ sleep::sleep_millis(sleep_time_millis).await;
+ });
+ }
+}
+
+// Unused function; required since this file is built as a `bin`:
+fn main() {}
diff --git a/crates/wasmtime/src/runtime/component/concurrent.rs b/crates/wasmtime/src/runtime/component/concurrent.rs
index f8d3c2cd50..1ae2172419 100644
--- a/crates/wasmtime/src/runtime/component/concurrent.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent.rs
@@ -78,6 +78,7 @@ use std::ops::DerefMut;
use std::pin::{Pin, pin};
use std::ptr::{self, NonNull};
use std::slice;
+use std::sync::Arc;
use std::task::{Context, Poll, Waker};
use std::vec::Vec;
use table::{TableDebug, TableId};
@@ -1055,7 +1056,7 @@ impl Instance {
/// # let bar = instance.get_typed_func::<(u32,), ()>(&mut store, "bar")?;
/// instance.run_concurrent(&mut store, async |accessor| -> wasmtime::Result<_> {
/// let resource = accessor.with(|mut access| access.get().table.push(MyResource(42)))?;
- /// let (another_resource,) = foo.call_concurrent(accessor, (resource,)).await?;
+ /// let (another_resource,) = foo.call_concurrent(accessor, (resource,)).await?.0;
/// let value = accessor.with(|mut access| access.get().table.delete(another_resource))?;
/// bar.call_concurrent(accessor, (value.0,)).await?;
/// Ok(())
@@ -3467,6 +3468,13 @@ enum Caller {
Host {
/// If present, may be used to deliver the result.
tx: Option<oneshot::Sender<LiftedResult>>,
+ /// Channel to notify once all subtasks spawned by this caller have
+ /// completed.
+ ///
+ /// Note that we'll never actually send anything to this channel;
+ /// dropping it when the refcount goes to zero is sufficient to notify
+ /// the receiver.
+ exit_tx: Arc<oneshot::Sender<()>>,
/// If true, remove the task from the concurrent state that owns it
/// automatically after it completes.
remove_task_automatically: bool,
@@ -3601,32 +3609,38 @@ impl GuestTask {
state.delete(self.sync_call_set)?;
// Reparent any pending subtasks to the caller.
- if let Caller::Guest {
- task,
- instance: runtime_instance,
- } = &self.caller
- {
- let task_mut = state.get_mut(*task)?;
- let present = task_mut.subtasks.remove(&me);
- assert!(present);
+ match &self.caller {
+ Caller::Guest {
+ task,
+ instance: runtime_instance,
+ } => {
+ let task_mut = state.get_mut(*task)?;
+ let present = task_mut.subtasks.remove(&me);
+ assert!(present);
- for subtask in &self.subtasks {
- task_mut.subtasks.insert(*subtask);
- }
+ for subtask in &self.subtasks {
+ task_mut.subtasks.insert(*subtask);
+ }
- for subtask in &self.subtasks {
- state.get_mut(*subtask)?.caller = Caller::Guest {
- task: *task,
- instance: *runtime_instance,
- };
+ for subtask in &self.subtasks {
+ state.get_mut(*subtask)?.caller = Caller::Guest {
+ task: *task,
+ instance: *runtime_instance,
+ };
+ }
}
- } else {
- for subtask in &self.subtasks {
- state.get_mut(*subtask)?.caller = Caller::Host {
- tx: None,
- remove_task_automatically: true,
- call_post_return_automatically: true,
- };
+ Caller::Host { exit_tx, .. } => {
+ for subtask in &self.subtasks {
+ state.get_mut(*subtask)?.caller = Caller::Host {
+ tx: None,
+ // Clone `exit_tx` to ensure that it is only dropped
+ // once all transitive subtasks of the host call have
+ // exited:
+ exit_tx: exit_tx.clone(),
+ remove_task_automatically: true,
+ call_post_return_automatically: true,
+ };
+ }
}
}
@@ -4325,6 +4339,9 @@ pub(crate) struct PreparedCall<R> {
/// The `oneshot::Receiver` to which the result of the call will be
/// delivered when it is available.
rx: oneshot::Receiver<LiftedResult>,
+ /// The `oneshot::Receiver` which will resolve when the task -- and any
+ /// transitive subtasks -- have all exited.
+ exit_rx: oneshot::Receiver<()>,
_phantom: PhantomData<R>,
}
@@ -4393,6 +4410,7 @@ pub(crate) fn prepare_call<T, R>(
assert!(state.guest_task.is_none());
let (tx, rx) = oneshot::channel();
+ let (exit_tx, exit_rx) = oneshot::channel();
let mut task = GuestTask::new(
state,
@@ -4411,6 +4429,7 @@ pub(crate) fn prepare_call<T, R>(
},
Caller::Host {
tx: Some(tx),
+ exit_tx: Arc::new(exit_tx),
remove_task_automatically,
call_post_return_automatically,
},
@@ -4449,6 +4468,7 @@ pub(crate) fn prepare_call<T, R>(
task,
param_count,
rx,
+ exit_rx,
_phantom: PhantomData,
})
}
@@ -4462,12 +4482,13 @@ pub(crate) fn prepare_call<T, R>(
pub(crate) fn queue_call<T: 'static, R: Send + 'static>(
mut store: StoreContextMut<T>,
prepared: PreparedCall<R>,
-) -> Result<impl Future<Output = Result<R>> + Send + 'static + use<T, R>> {
+) -> Result<impl Future<Output = Result<(R, oneshot::Receiver<()>)>> + Send + 'static + use<T, R>> {
let PreparedCall {
handle,
task,
param_count,
rx,
+ exit_rx,
..
} = prepared;
@@ -4475,9 +4496,9 @@ pub(crate) fn queue_call<T: 'static, R: Send + 'static>(
Ok(checked(
handle.instance(),
- rx.map(|result| {
+ rx.map(move |result| {
result
- .map(|v| *v.downcast().unwrap())
+ .map(|v| (*v.downcast().unwrap(), exit_rx))
.map_err(anyhow::Error::from)
}),
))
diff --git a/crates/wasmtime/src/runtime/component/func.rs b/crates/wasmtime/src/runtime/component/func.rs
index ad97995acf..30fc79c51b 100644
--- a/crates/wasmtime/src/runtime/component/func.rs
+++ b/crates/wasmtime/src/runtime/component/func.rs
@@ -8,6 +8,7 @@ use crate::runtime::vm::component::{ComponentInstance, InstanceFlags, ResourceTa
use crate::runtime::vm::{Export, VMFuncRef};
use crate::store::StoreOpaque;
use crate::{AsContext, AsContextMut, StoreContextMut, ValRaw};
+use anyhow::Context as _;
use core::mem::{self, MaybeUninit};
use core::ptr::NonNull;
use wasmtime_environ::component::{
@@ -283,6 +284,7 @@ impl Func {
.run_concurrent(&mut store, async |store| {
self.call_concurrent_dynamic(store, params, results, false)
.await
+ .map(drop)
})
.await?
}
@@ -335,6 +337,9 @@ impl Func {
/// (if any) automatically when the guest task completes -- no need to
/// explicitly call `Func::post_return` afterward.
///
+ /// This returns a [`TaskExit`] representing the completion of the guest
+ /// task and any transitive subtasks it might create.
+ ///
/// # Panics
///
/// Panics if the store that the [`Accessor`] is derived from does not own
@@ -345,8 +350,8 @@ impl Func {
accessor: impl AsAccessor<Data: Send>,
params: &[Val],
results: &mut [Val],
- ) -> Result<()> {
- self.call_concurrent_dynamic(accessor.as_accessor(), params, results, true)
+ ) -> Result<TaskExit> {
+ self.call_concurrent_dynamic(accessor, params, results, true)
.await
}
@@ -354,13 +359,12 @@ impl Func {
#[cfg(feature = "component-model-async")]
async fn call_concurrent_dynamic(
self,
- store: impl AsAccessor<Data: Send>,
+ accessor: impl AsAccessor<Data: Send>,
params: &[Val],
results: &mut [Val],
call_post_return_automatically: bool,
- ) -> Result<()> {
- let store = store.as_accessor();
- let result = store.with(|mut store| {
+ ) -> Result<TaskExit> {
+ let result = accessor.as_accessor().with(|mut store| {
assert!(
store.as_context_mut().0.async_support(),
"cannot use `call_concurrent` when async support is not enabled on the config"
@@ -374,12 +378,12 @@ impl Func {
concurrent::queue_call(store.as_context_mut(), prepared)
})?;
- let run_results = result.await?;
+ let (run_results, rx) = result.await?;
assert_eq!(run_results.len(), results.len());
for (result, slot) in run_results.into_iter().zip(results) {
*slot = result;
}
- Ok(())
+ Ok(TaskExit(rx))
}
/// Calls `concurrent::prepare_call` with monomorphized functions for
@@ -934,3 +938,35 @@ impl Func {
lift(&mut cx, ty)
}
}
+
+/// Represents the completion of a task created using
+/// `[Typed]Func::call_concurrent`.
+///
+/// In general, a guest task may continue running after returning a value.
+/// Moreover, any given guest task may create its own subtasks before or after
+/// returning and may exit before some or all of those subtasks have finished
+/// running. In that case, the still-running subtasks will be "reparented" to
+/// the nearest surviving caller, which may be the original host call. The
+/// future returned by `TaskExit::block` will resolve once all transitive
+/// subtasks created directly or indirectly by the original call to
+/// `Instance::call_concurrent` have exited.
+#[cfg(feature = "component-model-async")]
+pub struct TaskExit(futures::channel::oneshot::Receiver<()>);
+
+#[cfg(feature = "component-model-async")]
+impl TaskExit {
+ /// Returns a future which will resolve once all transitive subtasks created
+ /// directly or indirectly by the original call to
+ /// `Instance::call_concurrent` have exited.
+ pub async fn block(self, accessor: impl AsAccessor<Data: Send>) {
+ // The current implementation makes no use of `accessor`, but future
+ // implementations might (e.g. by using a more efficient mechanism than
+ // a oneshot channel).
+ _ = accessor;
+
+ // We don't care whether the sender sent us a value or was dropped
+ // first; either one counts as a notification, so we ignore the result
+ // once the future resolves:
+ _ = self.0.await;
+ }
+}
diff --git a/crates/wasmtime/src/runtime/component/func/typed.rs b/crates/wasmtime/src/runtime/component/func/typed.rs
index 3e669ab278..e86aea10cc 100644
--- a/crates/wasmtime/src/runtime/component/func/typed.rs
+++ b/crates/wasmtime/src/runtime/component/func/typed.rs
@@ -16,6 +16,8 @@ use wasmtime_environ::component::{
#[cfg(feature = "component-model-async")]
use crate::component::concurrent::{self, AsAccessor, PreparedCall};
+#[cfg(feature = "component-model-async")]
+use crate::component::func::TaskExit;
/// A statically-typed version of [`Func`] which takes `Params` as input and
/// returns `Return`.
@@ -232,7 +234,9 @@ where
let result = concurrent::queue_call(wrapper.store.as_context_mut(), prepared)?;
self.func
.instance
- .run_concurrent(wrapper.store.as_context_mut(), async |_| result.await)
+ .run_concurrent(wrapper.store.as_context_mut(), async |_| {
+ Ok(result.await?.0)
+ })
.await?
}
#[cfg(not(feature = "component-model-async"))]
@@ -252,6 +256,10 @@ where
/// (if any) automatically when the guest task completes -- no need to
/// explicitly call `Func::post_return` afterward.
///
+ /// Besides the task's return value, this returns a [`TaskExit`]
+ /// representing the completion of the guest task and any transitive
+ /// subtasks it might create.
+ ///
/// # Panics
///
/// Panics if the store that the [`Accessor`] is derived from does not own
@@ -261,13 +269,12 @@ where
self,
accessor: impl AsAccessor<Data: Send>,
params: Params,
- ) -> Result<Return>
+ ) -> Result<(Return, TaskExit)>
where
Params: 'static,
Return: 'static,
{
- let accessor = accessor.as_accessor();
- let result = accessor.with(|mut store| {
+ let result = accessor.as_accessor().with(|mut store| {
let mut store = store.as_context_mut();
assert!(
store.0.async_support(),
@@ -280,8 +287,8 @@ where
})?;
concurrent::queue_call(store, prepared)
});
-
- result?.await
+ let (result, rx) = result?.await?;
+ Ok((result, TaskExit(rx)))
}
fn lower_args<T>(
diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs
index 77e7f5f806..da2e51a6ae 100644
--- a/crates/wit-bindgen/src/lib.rs
+++ b/crates/wit-bindgen/src/lib.rs
@@ -2790,14 +2790,20 @@ impl<'a> InterfaceGenerator<'a> {
if func.result.is_some() {
uwrite!(self.src, "ret0,");
}
- if flags.contains(FunctionFlags::ASYNC | FunctionFlags::STORE) {
+
+ let field = if flags.contains(FunctionFlags::ASYNC | FunctionFlags::STORE) {
+ // TODO: Add an option to support returning the `TaskExit` from
+ // `call_concurrent` as well as the result.
uwrite!(self.src, ") = callee.call_concurrent(accessor, (");
+ ".0"
} else {
uwrite!(
self.src,
") = callee.call{async__}(store.as_context_mut(), ("
);
- }
+ ""
+ };
+
for (i, _) in func.params.iter().enumerate() {
uwrite!(self.src, "arg{}, ", i);
}
@@ -2807,7 +2813,7 @@ impl<'a> InterfaceGenerator<'a> {
} else {
""
};
- uwriteln!(self.src, ")){instrument}{await_}?;");
+ uwriteln!(self.src, ")){instrument}{await_}?{field};");
let instrument = if flags.contains(FunctionFlags::ASYNC | FunctionFlags::TRACING) {
".instrument(span)"
diff --git a/tests/all/component_model/func.rs b/tests/all/component_model/func.rs
index a74dc929f5..158cc9adfa 100644
--- a/tests/all/component_model/func.rs
+++ b/tests/all/component_model/func.rs
@@ -922,7 +922,7 @@ async fn async_reentrance() -> Result<()> {
let message = "cannot enter component instance";
match instance
.run_concurrent(&mut store, async move |accessor| {
- func.call_concurrent(accessor, (42,)).await
+ anyhow::Ok(func.call_concurrent(accessor, (42,)).await?.0)
})
.await
{
@@ -1052,7 +1052,7 @@ async fn task_return_trap(component: &str, substring: &str) -> Result<()> {
let func = instance.get_typed_func::<(), ()>(&mut store, "foo")?;
match instance
.run_concurrent(&mut store, async move |accessor| {
- func.call_concurrent(accessor, ()).await
+ anyhow::Ok(func.call_concurrent(accessor, ()).await?.0)
})
.await
{
@@ -1251,7 +1251,8 @@ async fn test_many_parameters(dynamic: bool, concurrent: bool) -> Result<()> {
if concurrent {
instance
.run_concurrent(&mut store, async |store| {
- func.call_concurrent(store, &input, &mut results).await
+ func.call_concurrent(store, &input, &mut results).await?;
+ anyhow::Ok(())
})
.await??;
} else {
@@ -1295,7 +1296,7 @@ async fn test_many_parameters(dynamic: bool, concurrent: bool) -> Result<()> {
if concurrent {
instance
.run_concurrent(&mut store, async move |accessor| {
- func.call_concurrent(accessor, input).await
+ anyhow::Ok(func.call_concurrent(accessor, input).await?.0)
})
.await??
.0
@@ -1684,7 +1685,8 @@ async fn test_many_results(dynamic: bool, concurrent: bool) -> Result<()> {
if concurrent {
instance
.run_concurrent(&mut store, async |store| {
- func.call_concurrent(store, &[], &mut results).await
+ func.call_concurrent(store, &[], &mut results).await?;
+ anyhow::Ok(())
})
.await??;
} else {
@@ -1773,7 +1775,7 @@ async fn test_many_results(dynamic: bool, concurrent: bool) -> Result<()> {
if concurrent {
instance
.run_concurrent(&mut store, async move |accessor| {
- func.call_concurrent(accessor, ()).await
+ anyhow::Ok(func.call_concurrent(accessor, ()).await?.0)
})
.await??
.0
diff --git a/tests/all/component_model/import.rs b/tests/all/component_model/import.rs
index 0b3e62948c..09e5881f53 100644
--- a/tests/all/component_model/import.rs
+++ b/tests/all/component_model/import.rs
@@ -835,7 +835,7 @@ async fn test_stack_and_heap_args_and_rets(concurrent: bool) -> Result<()> {
if concurrent {
instance
.run_concurrent(&mut store, async move |accessor| {
- run.call_concurrent(accessor, ()).await
+ anyhow::Ok(run.call_concurrent(accessor, ()).await?.0)
})
.await??;
} else {
@@ -959,7 +959,8 @@ async fn test_stack_and_heap_args_and_rets(concurrent: bool) -> Result<()> {
if concurrent {
instance
.run_concurrent(&mut store, async |store| {
- run.call_concurrent(store, &[], &mut []).await
+ run.call_concurrent(store, &[], &mut []).await?;
+ anyhow::Ok(())
})
.await??;
} else {
diff --git a/tests/all/pulley.rs b/tests/all/pulley.rs
index abc99a4752..eea59a97f1 100644
--- a/tests/all/pulley.rs
+++ b/tests/all/pulley.rs
@@ -454,28 +454,28 @@ async fn pulley_provenance_test_async_components() -> Result<()> {
let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackless")?;
instance
.run_concurrent(&mut store, async move |accessor| {
- run.call_concurrent(accessor, ()).await
+ anyhow::Ok(run.call_concurrent(accessor, ()).await?.0)
})
.await??;
let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackful")?;
instance
.run_concurrent(&mut store, async move |accessor| {
- run.call_concurrent(accessor, ()).await
+ anyhow::Ok(run.call_concurrent(accessor, ()).await?.0)
})
.await??;
let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackless-stackless")?;
instance
.run_concurrent(&mut store, async move |accessor| {
- run.call_concurrent(accessor, ()).await
+ anyhow::Ok(run.call_concurrent(accessor, ()).await?.0)
})
.await??;
let run = instance.get_typed_func::<(), ()>(&mut store, "run-stackful-stackful")?;
instance
.run_concurrent(&mut store, async move |accessor| {
- run.call_concurrent(accessor, ()).await
+ anyhow::Ok(run.call_concurrent(accessor, ()).await?.0)
})
.await??;
}