From 7d8d96f65efea8390af0fc31d2db567db6f4d04f Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 25 Nov 2026 12:59:38 -0800 Subject: [PATCH] Validation: the stencil reference face reads its faces by value Fix-forward of 522914946b, whose build failed (job m3-max-73916, E0597): the array of face references was a temporary of the method's tail expression, which outlives the local Vulkan state it borrowed under edition 2021's drop order. The faces are Copy, so the array holds them by value; the rule is unchanged. Verified at this commit: cargo fmt only; the next build job compiles it. --- .../src/executor_contract/depth_stencil.rs | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/crates/metal2vulkan-validation/src/executor_contract/depth_stencil.rs b/crates/metal2vulkan-validation/src/executor_contract/depth_stencil.rs index 36f4cab7c..80807cac7 100644 --- a/crates/metal2vulkan-validation/src/executor_contract/depth_stencil.rs +++ b/crates/metal2vulkan-validation/src/executor_contract/depth_stencil.rs @@ -12,7 +12,6 @@ use crate::case::{ use crate::check::interface::AirInterface; use metal2vulkan::metal::state::{ depth_stencil_state, DepthStencilDescriptor, DepthStencilState, StencilDescriptor, - StencilOpState, }; use metal2vulkan::metal::{CompareFunction, StencilOperation, Winding}; use metal2vulkan::vk; @@ -136,19 +135,15 @@ impl DrawDepthStencil { if !state.stencil_test_enable { return None; } - let fixed = |face: &StencilOpState| { - matches!( - face.compare_op, - vk::CompareOp::ALWAYS | vk::CompareOp::NEVER - ) - }; - [ - ("front", &state.front, &self.descriptor.front_face_stencil), - ("back", &state.back, &self.descriptor.back_face_stencil), - ] - .into_iter() - .find(|&(_, face, _)| !fixed(face)) - .map(|(name, _, metal)| (name, metal.stencil_compare_function)) + let fixed = |op: vk::CompareOp| matches!(op, vk::CompareOp::ALWAYS | vk::CompareOp::NEVER); + let faces = [ + ("front", state.front, self.descriptor.front_face_stencil), + ("back", state.back, self.descriptor.back_face_stencil), + ]; + faces + .into_iter() + .find(|(_, face, _)| !fixed(face.compare_op)) + .map(|(name, _, metal)| (name, metal.stencil_compare_function)) } }