Unverified Commit 5cd0cce2 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

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...
parent c4731a2e
......@@ -112,7 +112,7 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream {
quote! {
{
#(
let #fields = turbo_tasks::TaskInput::resolve(#fields).await?;
let #fields = turbo_tasks::TaskInput::resolve_input(#fields).await?;
)*
Ok(#ident { #(#fields),* })
}
......@@ -126,7 +126,7 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream {
quote! {
{
#(
let #fields = turbo_tasks::TaskInput::resolve(#fields).await?;
let #fields = turbo_tasks::TaskInput::resolve_input(#fields).await?;
)*
Ok(#ident(#(#fields),*))
}
......@@ -169,7 +169,7 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream {
#[allow(non_snake_case)]
#[allow(unreachable_code)] // This can occur for enums with no variants.
#[allow(clippy::manual_async_fn)] // some impls need the manual return type to work :(
fn resolve(
fn resolve_input(
&self,
) -> impl
::std::future::Future<Output = turbo_tasks::Result<Self>> +
......
......@@ -518,7 +518,7 @@ impl TurboFn<'_> {
let (#(#exposed_input_idents,)*) = turbo_tasks::macro_helpers
::downcast_args_ref::<(#(#exposed_input_types,)*)>(magic_any);
let resolved = (#(
<_ as turbo_tasks::TaskInput>::resolve(
<_ as turbo_tasks::TaskInput>::resolve_input(
#inline_input_idents
).await?,
)*);
......
......@@ -97,7 +97,7 @@ impl ArgMeta {
fn resolve_functor_impl<T: MagicAny + TaskInput>(value: &dyn MagicAny) -> ResolveFuture<'_> {
Box::pin(async {
let value = downcast_args_ref::<T>(value);
let resolved = value.resolve().await?;
let resolved = value.resolve_input().await?;
Ok(Box::new(resolved) as Box<dyn MagicAny>)
})
}
......
......@@ -14,7 +14,7 @@ use crate::{
///
/// See also [`ConcreteTaskInput`].
pub trait TaskInput: Send + Sync + Clone + Debug + PartialEq + Eq + Hash {
fn resolve(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
async { Ok(self.clone()) }
}
fn is_resolved(&self) -> bool {
......@@ -62,10 +62,10 @@ where
self.iter().any(TaskInput::is_transient)
}
async fn resolve(&self) -> Result<Self> {
async fn resolve_input(&self) -> Result<Self> {
let mut resolved = Vec::with_capacity(self.len());
for value in self {
resolved.push(value.resolve().await?);
resolved.push(value.resolve_input().await?);
}
Ok(resolved)
}
......@@ -89,9 +89,9 @@ where
}
}
async fn resolve(&self) -> Result<Self> {
async fn resolve_input(&self) -> Result<Self> {
match self {
Some(value) => Ok(Some(value.resolve().await?)),
Some(value) => Ok(Some(value.resolve_input().await?)),
None => Ok(None),
}
}
......@@ -109,7 +109,7 @@ where
self.node.get_task_id().is_transient()
}
async fn resolve(&self) -> Result<Self> {
async fn resolve_input(&self) -> Result<Self> {
Vc::resolve(*self).await
}
}
......@@ -128,7 +128,7 @@ where
self.node.is_transient()
}
async fn resolve(&self) -> Result<Self> {
async fn resolve_input(&self) -> Result<Self> {
Ok(*self)
}
}
......@@ -228,10 +228,10 @@ where
L: TaskInput,
R: TaskInput,
{
fn resolve(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
self.as_ref().map_either(
|l| async move { anyhow::Ok(Either::Left(l.resolve().await?)) },
|r| async move { anyhow::Ok(Either::Right(r.resolve().await?)) },
|l| async move { anyhow::Ok(Either::Left(l.resolve_input().await?)) },
|r| async move { anyhow::Ok(Either::Right(r.resolve_input().await?)) },
)
}
......@@ -264,15 +264,15 @@ macro_rules! tuple_impls {
}
#[allow(non_snake_case)]
async fn resolve(&self) -> Result<Self> {
async fn resolve_input(&self) -> Result<Self> {
let ($($name,)+) = self;
Ok(($($name.resolve().await?,)+))
Ok(($($name.resolve_input().await?,)+))
}
}
};
}
// Implement `TaskInput` for all tuples of 1 to 16 elements.
// Implement `TaskInput` for all tuples of 1 to 12 elements.
tuple_impls! { A }
tuple_impls! { A B }
tuple_impls! { A B C }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment