Skip to content

Commit 5cd0cce

Browse files
authored
Turbopack: disambiguate TaskInput::resolve (#75661)
Disambiguate `TaskInput::resolve` from `Vc::resolve` and `ResolvedVc::resolve`. Turns out there was only a single instance where `resolve()` turned out to be the wrong function anyway...
1 parent c4731a2 commit 5cd0cce

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

turbopack/crates/turbo-tasks-macros/src/derive/task_input_macro.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream {
112112
quote! {
113113
{
114114
#(
115-
let #fields = turbo_tasks::TaskInput::resolve(#fields).await?;
115+
let #fields = turbo_tasks::TaskInput::resolve_input(#fields).await?;
116116
)*
117117
Ok(#ident { #(#fields),* })
118118
}
@@ -126,7 +126,7 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream {
126126
quote! {
127127
{
128128
#(
129-
let #fields = turbo_tasks::TaskInput::resolve(#fields).await?;
129+
let #fields = turbo_tasks::TaskInput::resolve_input(#fields).await?;
130130
)*
131131
Ok(#ident(#(#fields),*))
132132
}
@@ -169,7 +169,7 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream {
169169
#[allow(non_snake_case)]
170170
#[allow(unreachable_code)] // This can occur for enums with no variants.
171171
#[allow(clippy::manual_async_fn)] // some impls need the manual return type to work :(
172-
fn resolve(
172+
fn resolve_input(
173173
&self,
174174
) -> impl
175175
::std::future::Future<Output = turbo_tasks::Result<Self>> +

turbopack/crates/turbo-tasks-macros/src/func.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ impl TurboFn<'_> {
518518
let (#(#exposed_input_idents,)*) = turbo_tasks::macro_helpers
519519
::downcast_args_ref::<(#(#exposed_input_types,)*)>(magic_any);
520520
let resolved = (#(
521-
<_ as turbo_tasks::TaskInput>::resolve(
521+
<_ as turbo_tasks::TaskInput>::resolve_input(
522522
#inline_input_idents
523523
).await?,
524524
)*);

turbopack/crates/turbo-tasks/src/native_function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl ArgMeta {
9797
fn resolve_functor_impl<T: MagicAny + TaskInput>(value: &dyn MagicAny) -> ResolveFuture<'_> {
9898
Box::pin(async {
9999
let value = downcast_args_ref::<T>(value);
100-
let resolved = value.resolve().await?;
100+
let resolved = value.resolve_input().await?;
101101
Ok(Box::new(resolved) as Box<dyn MagicAny>)
102102
})
103103
}

turbopack/crates/turbo-tasks/src/task/task_input.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
///
1515
/// See also [`ConcreteTaskInput`].
1616
pub trait TaskInput: Send + Sync + Clone + Debug + PartialEq + Eq + Hash {
17-
fn resolve(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
17+
fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
1818
async { Ok(self.clone()) }
1919
}
2020
fn is_resolved(&self) -> bool {
@@ -62,10 +62,10 @@ where
6262
self.iter().any(TaskInput::is_transient)
6363
}
6464

65-
async fn resolve(&self) -> Result<Self> {
65+
async fn resolve_input(&self) -> Result<Self> {
6666
let mut resolved = Vec::with_capacity(self.len());
6767
for value in self {
68-
resolved.push(value.resolve().await?);
68+
resolved.push(value.resolve_input().await?);
6969
}
7070
Ok(resolved)
7171
}
@@ -89,9 +89,9 @@ where
8989
}
9090
}
9191

92-
async fn resolve(&self) -> Result<Self> {
92+
async fn resolve_input(&self) -> Result<Self> {
9393
match self {
94-
Some(value) => Ok(Some(value.resolve().await?)),
94+
Some(value) => Ok(Some(value.resolve_input().await?)),
9595
None => Ok(None),
9696
}
9797
}
@@ -109,7 +109,7 @@ where
109109
self.node.get_task_id().is_transient()
110110
}
111111

112-
async fn resolve(&self) -> Result<Self> {
112+
async fn resolve_input(&self) -> Result<Self> {
113113
Vc::resolve(*self).await
114114
}
115115
}
@@ -128,7 +128,7 @@ where
128128
self.node.is_transient()
129129
}
130130

131-
async fn resolve(&self) -> Result<Self> {
131+
async fn resolve_input(&self) -> Result<Self> {
132132
Ok(*self)
133133
}
134134
}
@@ -228,10 +228,10 @@ where
228228
L: TaskInput,
229229
R: TaskInput,
230230
{
231-
fn resolve(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
231+
fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
232232
self.as_ref().map_either(
233-
|l| async move { anyhow::Ok(Either::Left(l.resolve().await?)) },
234-
|r| async move { anyhow::Ok(Either::Right(r.resolve().await?)) },
233+
|l| async move { anyhow::Ok(Either::Left(l.resolve_input().await?)) },
234+
|r| async move { anyhow::Ok(Either::Right(r.resolve_input().await?)) },
235235
)
236236
}
237237

@@ -264,15 +264,15 @@ macro_rules! tuple_impls {
264264
}
265265

266266
#[allow(non_snake_case)]
267-
async fn resolve(&self) -> Result<Self> {
267+
async fn resolve_input(&self) -> Result<Self> {
268268
let ($($name,)+) = self;
269-
Ok(($($name.resolve().await?,)+))
269+
Ok(($($name.resolve_input().await?,)+))
270270
}
271271
}
272272
};
273273
}
274274

275-
// Implement `TaskInput` for all tuples of 1 to 16 elements.
275+
// Implement `TaskInput` for all tuples of 1 to 12 elements.
276276
tuple_impls! { A }
277277
tuple_impls! { A B }
278278
tuple_impls! { A B C }

0 commit comments

Comments
 (0)