From 423146d5b00c1a9d8806c976640681fbdd3ffa72 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 8 Aug 2024 08:31:23 +0200 Subject: [PATCH] fix task id reuse --- .../crates/turbo-tasks-memory/src/memory_backend.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/turbopack/crates/turbo-tasks-memory/src/memory_backend.rs b/turbopack/crates/turbo-tasks-memory/src/memory_backend.rs index 78e79fa105e89..73b92278f7ba3 100644 --- a/turbopack/crates/turbo-tasks-memory/src/memory_backend.rs +++ b/turbopack/crates/turbo-tasks-memory/src/memory_backend.rs @@ -26,8 +26,8 @@ use turbo_tasks::{ }, event::EventListener, util::{IdFactoryWithReuse, NoMoveVec}, - CellId, RawVc, TaskId, TaskIdSet, TraitTypeId, TurboTasksBackendApi, Unused, ValueTypeId, - TRANSIENT_TASK_BIT, + CellId, RawVc, TaskId, TaskIdSet, TaskInput, TraitTypeId, TurboTasksBackendApi, Unused, + ValueTypeId, TRANSIENT_TASK_BIT, }; use crate::{ @@ -272,8 +272,13 @@ impl MemoryBackend { drop(entry); unsafe { task_storage.remove(index); - let new_id = Unused::new_unchecked(new_id); - turbo_tasks.reuse_persistent_task_id(new_id); + if new_id.is_transient() { + let new_id = Unused::new_unchecked(new_id); + turbo_tasks.reuse_transient_task_id(new_id); + } else { + let new_id = Unused::new_unchecked(new_id); + turbo_tasks.reuse_persistent_task_id(new_id); + } } task_id }