From ade0f7f5126444efcbc24cfb80b2afb4b801a10f Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 12 Nov 2026 17:11:19 -0800 Subject: [PATCH] A queue's held next context is kept as a boxed Any, not by its type What: Slots::next holds the HeldContext as Box. Why: naming HeldContext there made the command buffer's Send and Sync depend on Contexts, which holds command buffers, and rustc's auto-trait evaluation overflowed in the conformance and validation crates (lint 23378-80). Verified: the lint that follows builds them. --- crates/metal2vulkan-runtime/src/queue.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/queue.rs b/crates/metal2vulkan-runtime/src/queue.rs index b952bc9af..bfe46c9bc 100644 --- a/crates/metal2vulkan-runtime/src/queue.rs +++ b/crates/metal2vulkan-runtime/src/queue.rs @@ -113,6 +113,7 @@ use super::queue_share::Choice; use super::render::Carried; use super::texture::copy_images::CopyImages; use super::texture::kept_image::KeptImages; +use std::any::Any; use std::sync::atomic::{AtomicU8, AtomicUsize, Ordering}; use std::sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock}; use std::time::Instant; @@ -267,8 +268,9 @@ pub(crate) struct Slots { rest: OnceLock, /// The context of the queue's next place, held while a command buffer committed here holds /// its slot ([`QueueGen::follow`]): released as the last of them gives its slot back. Taken - /// under `held`'s lock. - next: Mutex>, + /// under `held`'s lock. A [`HeldContext`], whose type it does not name: the contexts hold the + /// command buffers that hold these slots. + next: Mutex>>, } /// A command queue's context on the place a recovery gave it, held until the command buffers @@ -331,7 +333,7 @@ impl Slots { fn hold_next(&self, next: HeldContext) { let held = self.lock(); if held.all > held.open { - *lock(&self.next) = Some(next); + *lock(&self.next) = Some(Box::new(next)); } }