Skip to content

Commit

Permalink
verify persistent function only calls persistent functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Sep 5, 2024
1 parent d2571a8 commit 976dbe9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,14 @@ impl Backend for TurboTasksBackend {
parent_task: TaskId,
turbo_tasks: &dyn TurboTasksBackendApi<Self>,
) -> TaskId {
if !parent_task.is_transient() {
let parent_task_type = self.lookup_task_type(parent_task);
panic!(
"Calling transient function {} from persistent function function {} is not allowed",
task_type.get_name(),
parent_task_type.map_or_else(|| "unknown".into(), |t| t.get_name())
);
}
if let Some(task_id) = self.task_cache.lookup_forward(&task_type) {
self.connect_child(parent_task, task_id, turbo_tasks);
return task_id;
Expand Down

0 comments on commit 976dbe9

Please sign in to comment.