Skip to content

Commit c60eea2

Browse files
committed
fix(turbo-tasks): Store persistence of wrapped task on RawVc::LocalOutput
1 parent cf236ae commit c60eea2

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ pub struct UpdateInfo {
307307
placeholder_for_future_fields: (),
308308
}
309309

310-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
310+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
311311
pub enum TaskPersistence {
312312
/// Tasks that may be persisted across sessions using serialization.
313313
Persistent,
@@ -822,7 +822,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
822822
#[cfg(not(feature = "tokio_tracing"))]
823823
tokio::task::spawn(future);
824824

825-
RawVc::LocalOutput(parent_task_id, execution_id, local_task_id)
825+
RawVc::LocalOutput(parent_task_id, persistence, execution_id, local_task_id)
826826
}
827827

828828
fn begin_primary_job(&self) {

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
manager::{read_local_output, read_task_cell, read_task_output, with_turbo_tasks},
1313
registry::{self, get_value_type},
1414
turbo_tasks, CollectiblesSource, ReadCellOptions, ReadConsistency, ResolvedVc, TaskId,
15-
TraitTypeId, ValueType, ValueTypeId, VcValueTrait,
15+
TaskPersistence, TraitTypeId, ValueType, ValueTypeId, VcValueTrait,
1616
};
1717

1818
#[derive(Error, Debug)]
@@ -57,7 +57,7 @@ impl Display for CellId {
5757
pub enum RawVc {
5858
TaskOutput(TaskId),
5959
TaskCell(TaskId, CellId),
60-
LocalOutput(TaskId, ExecutionId, LocalTaskId),
60+
LocalOutput(TaskId, TaskPersistence, ExecutionId, LocalTaskId),
6161
}
6262

6363
impl RawVc {
@@ -79,9 +79,8 @@ impl RawVc {
7979

8080
pub fn is_transient(&self) -> bool {
8181
match self {
82-
RawVc::TaskOutput(task) | RawVc::TaskCell(task, ..) | RawVc::LocalOutput(task, ..) => {
83-
task.is_transient()
84-
}
82+
RawVc::TaskOutput(task) | RawVc::TaskCell(task, ..) => task.is_transient(),
83+
RawVc::LocalOutput(_, persistence, ..) => *persistence == TaskPersistence::Transient,
8584
}
8685
}
8786

@@ -145,7 +144,7 @@ impl RawVc {
145144
return Err(ResolveTypeError::NoContent);
146145
}
147146
}
148-
RawVc::LocalOutput(_task_id, execution_id, local_task_id) => {
147+
RawVc::LocalOutput(_task_id, _persistence, execution_id, local_task_id) => {
149148
current = read_local_output(&*tt, execution_id, local_task_id)
150149
.await
151150
.map_err(|source| ResolveTypeError::TaskError { source })?;
@@ -182,7 +181,7 @@ impl RawVc {
182181
consistency = ReadConsistency::Eventual;
183182
}
184183
RawVc::TaskCell(_, _) => return Ok(current),
185-
RawVc::LocalOutput(_task_id, execution_id, local_task_id) => {
184+
RawVc::LocalOutput(_task_id, _persistence, execution_id, local_task_id) => {
186185
debug_assert_eq!(consistency, ReadConsistency::Eventual);
187186
current = read_local_output(&*tt, execution_id, local_task_id).await?;
188187
}
@@ -197,7 +196,7 @@ impl RawVc {
197196
let mut current = self;
198197
loop {
199198
match current {
200-
RawVc::LocalOutput(_task_id, execution_id, local_task_id) => {
199+
RawVc::LocalOutput(_task_id, _persistence, execution_id, local_task_id) => {
201200
current = read_local_output(&*tt, execution_id, local_task_id).await?;
202201
}
203202
non_local => return Ok(non_local),
@@ -357,7 +356,7 @@ impl Future for ReadRawVcFuture {
357356
Err(err) => return Poll::Ready(Err(err)),
358357
}
359358
}
360-
RawVc::LocalOutput(_task_id, execution_id, local_output_id) => {
359+
RawVc::LocalOutput(_task_id, _persistence, execution_id, local_output_id) => {
361360
debug_assert_eq!(this.consistency, ReadConsistency::Eventual);
362361
let read_result = tt.try_read_local_output(execution_id, local_output_id);
363362
match read_result {

0 commit comments

Comments
 (0)