diff --git a/crates/next-api/src/module_graph.rs b/crates/next-api/src/module_graph.rs index 0c7928140071e..94eb60b27ff88 100644 --- a/crates/next-api/src/module_graph.rs +++ b/crates/next-api/src/module_graph.rs @@ -72,14 +72,21 @@ impl SingleModuleGraphNode { } } +/// A wrapper of [`DiGraph`] that implements [`TraceRawVcs`] (and [`NonLocalValue`]) when the nodes +/// and edges do. #[derive(Clone, Debug, ValueDebugFormat, Serialize, Deserialize)] -struct TracedDiGraph(DiGraph); -impl Default for TracedDiGraph { +struct TracedDiGraph(DiGraph); +impl Default for TracedDiGraph { fn default() -> Self { Self(Default::default()) } } -impl TraceRawVcs for TracedDiGraph { + +impl TraceRawVcs for TracedDiGraph +where + N: TraceRawVcs, + E: TraceRawVcs, +{ fn trace_raw_vcs(&self, trace_context: &mut TraceRawVcsContext) { for node in self.0.node_weights() { node.trace_raw_vcs(trace_context); @@ -89,14 +96,22 @@ impl TraceRawVcs for TracedDiGraph { } } } -impl Deref for TracedDiGraph { + +impl Deref for TracedDiGraph { type Target = DiGraph; fn deref(&self) -> &Self::Target { &self.0 } } -#[turbo_tasks::value(cell = "new", eq = "manual", into = "new", local)] +unsafe impl NonLocalValue for TracedDiGraph +where + N: NonLocalValue, + E: NonLocalValue, +{ +} + +#[turbo_tasks::value(cell = "new", eq = "manual", into = "new")] #[derive(Clone, Default)] pub struct SingleModuleGraph { graph: TracedDiGraph,