From 2c56729354983d7a9a757a5e5fa8016ae67b78aa Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Thu, 27 Aug 2026 19:25:15 +0200 Subject: [PATCH] Read a descriptor's variants without taking them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two agents worked in parallel and neither could see this. The frame-budget instrument matches `ParamKind::Enum { variants }` by value, which was free when a descriptor was `&'static` and everything in it was borrowed for the life of the program. Descriptors are owned now — a declaration parsed at run time cannot hand out a `&'static` — so `variants` is a `Vec` and the arm was moving out of a shared reference. Bound by reference instead. The arm only ever reads the length. The kind of conflict that survives a clean textual merge: git had nothing to report, and the two changes are only incompatible once they are in the same tree. Co-Authored-By: Claude Opus 5 (1M context) --- core/dr-gpu/examples/frame_budget.rs | 5 ++++- core/dr-gpu/tests/frame_budget.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/dr-gpu/examples/frame_budget.rs b/core/dr-gpu/examples/frame_budget.rs index 95c5d54..8040770 100644 --- a/core/dr-gpu/examples/frame_budget.rs +++ b/core/dr-gpu/examples/frame_budget.rs @@ -634,7 +634,10 @@ fn activate_everything(graph: &mut EditGraph, neighbourhood: bool) { ParamKind::Bool => 1.0, // The second variant when there is one. The first is the // default by construction — see `ParamDescriptor::choice`. - ParamKind::Enum { variants } => { + // Bound by reference: a descriptor's variants became an + // owned `Vec` when descriptors stopped being `&'static`, + // and this arm only ever reads the length. + ParamKind::Enum { ref variants } => { if variants.len() > 1 { 1.0 } else { diff --git a/core/dr-gpu/tests/frame_budget.rs b/core/dr-gpu/tests/frame_budget.rs index 3c23080..ce8bb26 100644 --- a/core/dr-gpu/tests/frame_budget.rs +++ b/core/dr-gpu/tests/frame_budget.rs @@ -282,7 +282,10 @@ fn full_point_chain() -> EditGraph { p.default + (far - p.default) * 0.25 } ParamKind::Bool => 1.0, - ParamKind::Enum { variants } => { + // Bound by reference: a descriptor's variants became an + // owned `Vec` when descriptors stopped being `&'static`, + // and this arm only ever reads the length. + ParamKind::Enum { ref variants } => { if variants.len() > 1 { 1.0 } else {