From ef4eadfd2507e0e9e4a0f4a5216fa9ed1b21e9d2 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 13 Mar 2025 09:09:52 -0700 Subject: [PATCH] [naga] Let `write_type_inner` match `TypeInner` exhaustively. (#7327) Change the match in the `naga::common::wgsl::TypeContext` trait's default implementation of `write_type_inner` to be exhaustive, so that it is more likely to be kept up to date when changes are made to the IR. Coincidentally, add support for `TypeInner::RayQuery`. --- naga/src/common/wgsl/types.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/naga/src/common/wgsl/types.rs b/naga/src/common/wgsl/types.rs index 2a25302ee..d84cb3201 100644 --- a/naga/src/common/wgsl/types.rs +++ b/naga/src/common/wgsl/types.rs @@ -245,7 +245,13 @@ pub trait TypeContext { let caps = if vertex_return { "" } else { "" }; write!(out, "acceleration_structure{}", caps)? } - _ => unreachable!("invalid TypeInner"), + TypeInner::Struct { .. } => { + unreachable!("structs can only be referenced by name in WGSL"); + } + TypeInner::RayQuery { vertex_return } => { + let caps = if vertex_return { "" } else { "" }; + write!(out, "ray_query{}", caps)? + } } Ok(())