From 755b4b712d0b13dffebd42aceef398dc948ce3bb Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 22 Nov 2026 21:30:15 -0800 Subject: [PATCH] Runtime tests: name the entry function type in function_tables clippy's type_complexity refused the bare fn-pointer slice under the device cfgs (m3-max-69685, clippy_gpu). --- crates/metal2vulkan-runtime/src/tests/function_tables.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/function_tables.rs b/crates/metal2vulkan-runtime/src/tests/function_tables.rs index c8da35ca1..796d3db90 100644 --- a/crates/metal2vulkan-runtime/src/tests/function_tables.rs +++ b/crates/metal2vulkan-runtime/src/tests/function_tables.rs @@ -32,6 +32,9 @@ mod on_device { /// The threads of each dispatch, and the words each writes. const THREADS: u32 = 12; + /// A function a table entry calls, as the CPU computes it. + type Op = fn(u32, u32) -> u32; + /// The library of the engine fixture `fixture.ll`, or None where `llvm-as` is missing. fn library(fixture: &str) -> Option { match llvm_assemble(&engine_dir().join(format!("{fixture}.ll"))) { @@ -56,7 +59,7 @@ mod on_device { /// What `visible_table_dispatch` writes for thread `tid` through a table of `entries`, each /// the function an entry calls (`None` for a null entry), at its index. - fn expected(entries: &[Option u32>]) -> Vec { + fn expected(entries: &[Option]) -> Vec { (0..THREADS) .map( |tid| match entries.get((tid as usize) % entries.len().max(1)) { @@ -100,8 +103,8 @@ mod on_device { let descriptor = ComputePipelineDescriptor::new(StageSource::Function( FunctionDescriptor::new(kernel).with_linked(linked), )); - let add: fn(u32, u32) -> u32 = |a, b| a + b; - let mul: fn(u32, u32) -> u32 = |a, b| a * b; + let add: Op = |a, b| a + b; + let mul: Op = |a, b| a * b; each_device("function_tables", |name, _, device| { assert!(device.supports_function_pointers(), "{name}"); let state = (device