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.
This commit is contained in:
Anees Iqbal committed 2026-11-25 13:24:41 -08:00
1 parent 5517e2df1b
commit 7d8d96f65e
1 file changed
+9 -14
@@ -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))
}
}