Skip to content

Commit 1ab8837

Browse files
authored
fix(turbo-tasks): Implement is_transient on OperationVc (#75291)
A function returning an `OperationVc` can call a transient function or have a transient argument. IMO, `TaskInput` should not have default method implementations to avoid potential footguns like this.
1 parent 75ab6b0 commit 1ab8837

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

turbopack/crates/turbo-tasks/src/vc/operation.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,16 @@ where
175175
}
176176
}
177177

178-
impl<T> TaskInput for OperationVc<T> where T: ?Sized + Send + Sync {}
178+
// NOTE: This uses the default implementation of `is_resolved` which returns `true` because we don't
179+
// want `OperationVc` arguments to get resolved when passed to a `#[turbo_tasks::function]`.
180+
impl<T> TaskInput for OperationVc<T>
181+
where
182+
T: ?Sized + Send + Sync,
183+
{
184+
fn is_transient(&self) -> bool {
185+
self.node.is_transient()
186+
}
187+
}
179188

180189
impl<T> From<RawVc> for OperationVc<T>
181190
where

0 commit comments

Comments
 (0)