diff --git a/turbopack/crates/turbo-tasks-macros/src/derive/task_input_macro.rs b/turbopack/crates/turbo-tasks-macros/src/derive/task_input_macro.rs index 7a96916784d59..a9b0c8b647fab 100644 --- a/turbopack/crates/turbo-tasks-macros/src/derive/task_input_macro.rs +++ b/turbopack/crates/turbo-tasks-macros/src/derive/task_input_macro.rs @@ -168,8 +168,17 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream { #[allow(non_snake_case)] #[allow(unreachable_code)] // This can occur for enums with no variants. - async fn resolve(&self) -> turbo_tasks::Result { - #resolve_impl + #[allow(clippy::manual_async_fn)] // some impls need the manual return type to work :( + fn resolve( + &self, + ) -> impl + ::std::future::Future> + + ::std::marker::Send + + '_ + { + async move { + #resolve_impl + } } } } diff --git a/turbopack/crates/turbo-tasks/src/task/task_input.rs b/turbopack/crates/turbo-tasks/src/task/task_input.rs index 17f5a9ba4b58c..9e6cca5139220 100644 --- a/turbopack/crates/turbo-tasks/src/task/task_input.rs +++ b/turbopack/crates/turbo-tasks/src/task/task_input.rs @@ -1,7 +1,6 @@ -use std::{any::Any, fmt::Debug, hash::Hash}; +use std::{any::Any, fmt::Debug, future::Future, hash::Hash}; use anyhow::Result; -use async_trait::async_trait; use serde::{Deserialize, Serialize}; use crate::{ @@ -12,10 +11,9 @@ use crate::{ /// [`#[turbo_tasks::function]`][crate::function] argument. /// /// See also [`ConcreteTaskInput`]. -#[async_trait] pub trait TaskInput: Send + Sync + Clone + Debug + PartialEq + Eq + Hash { - async fn resolve(&self) -> Result { - Ok(self.clone()) + fn resolve(&self) -> impl Future> + Send + '_ { + async { Ok(self.clone()) } } fn is_resolved(&self) -> bool { true @@ -28,7 +26,6 @@ pub trait TaskInput: Send + Sync + Clone + Debug + PartialEq + Eq + Hash { macro_rules! impl_task_input { ($($t:ty),*) => { $( - #[async_trait] impl TaskInput for $t {} )* }; @@ -48,7 +45,6 @@ impl_task_input! { ValueTypeId } -#[async_trait] impl TaskInput for Vec where T: TaskInput, @@ -70,7 +66,6 @@ where } } -#[async_trait] impl TaskInput for Option where T: TaskInput, @@ -97,7 +92,6 @@ where } } -#[async_trait] impl TaskInput for Vc where T: Send, @@ -220,7 +214,6 @@ impl<'de, T> Deserialize<'de> for TransientInstance { macro_rules! tuple_impls { ( $( $name:ident )+ ) => { - #[async_trait] impl<$($name: TaskInput),+> TaskInput for ($($name,)+) where $($name: TaskInput),+ {