Skip to content

Commit 760abaf

Browse files
committed
verify persistent function only calls persistent functions
1 parent ad55fcc commit 760abaf

File tree

1 file changed

+8
-0
lines changed
  • turbopack/crates/turbo-tasks-backend/src/backend

1 file changed

+8
-0
lines changed

turbopack/crates/turbo-tasks-backend/src/backend/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,14 @@ impl Backend for TurboTasksBackend {
592592
parent_task: TaskId,
593593
turbo_tasks: &dyn TurboTasksBackendApi<Self>,
594594
) -> TaskId {
595+
if !parent_task.is_transient() {
596+
let parent_task_type = self.lookup_task_type(parent_task);
597+
panic!(
598+
"Calling transient function {} from persistent function function {} is not allowed",
599+
task_type.get_name(),
600+
parent_task_type.map_or_else(|| "unknown".into(), |t| t.get_name())
601+
);
602+
}
595603
if let Some(task_id) = self.task_cache.lookup_forward(&task_type) {
596604
self.connect_child(parent_task, task_id, turbo_tasks);
597605
return task_id;

0 commit comments

Comments
 (0)