From 2d5e958cd038817af43cffba321b53dedf7f672a Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 5 Nov 2026 00:20:22 -0800 Subject: [PATCH] Hold a footprint's segment probes behind a trait object Clippy at ae5b372e7a (m3-max-622): consumers' proofs that the runtime's types are Send overflowed the recursion limit (examples/queue_share.rs's spawn, tests/consumer_auto_traits.rs's Mutex>): c1557efe2b made each command buffer's kept footprints hold their segments' work (Deferred) and step inputs, a second path to those types from every command buffer. A probe now holds a boxed Fn + Send + Sync that asks them, which ends the auto-trait proof there. (cherry picked from commit bcf80bd496254457f154aed8e587bf2d84176e36) --- .../src/command_buffer/mod.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs index b85483999..9cbc9c6b4 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs @@ -623,9 +623,11 @@ struct BuiltFootprint { /// `steps_after_the_gpu`), as they were where the footprint was built. A route met since, a /// host step or a rewrite moves one; a kept footprint stands only where none moved. struct SegmentProbe { - work: Deferred, - /// Its step inputs, where they are a recording that may come due again. - rerecord: Option, + /// Its answers now, asked of the segment's work and step inputs it holds. Held behind a + /// trait object, so the command buffer's auto-trait proofs reach no segment's work through + /// it: through the work's types they ran past consumers' recursion limit (`Send` of an + /// encoder held in a `Mutex`, `tests/consumer_auto_traits.rs`). + ask: Box [bool; 5] + Send + Sync>, answers: [bool; 5], } @@ -634,17 +636,17 @@ impl SegmentProbe { let rerecord = (segment.inputs.as_ref()) .filter(|inputs| matches!(inputs, StepInputs::Rerecord(_))) .cloned(); - let answers = probe_answers(&segment.work, rerecord.as_ref()); + let work = segment.work.clone(); + let ask = move || probe_answers(&work, rerecord.as_ref()); SegmentProbe { - work: segment.work.clone(), - rerecord, - answers, + answers: ask(), + ask: Box::new(ask), } } /// Whether its answers are as they were. fn holds(&self) -> bool { - probe_answers(&self.work, self.rerecord.as_ref()) == self.answers + (self.ask)() == self.answers } }