diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs index ea96fcb6fa..30fb802ea8 100644 --- a/naga/src/back/wgsl/writer.rs +++ b/naga/src/back/wgsl/writer.rs @@ -429,28 +429,7 @@ impl Writer { Ok(()) } -} -struct WriterTypeContext<'m> { - module: &'m Module, - names: &'m crate::FastHashMap, -} - -impl TypeContext for WriterTypeContext<'_> { - fn lookup_type(&self, handle: Handle) -> &crate::Type { - &self.module.types[handle] - } - - fn type_name(&self, handle: Handle) -> &str { - self.names[&NameKey::Type(handle)].as_str() - } - - fn write_override(&self, _: Handle, _: &mut W) -> core::fmt::Result { - unreachable!("overrides should be validated out"); - } -} - -impl Writer { fn write_type(&mut self, module: &Module, ty: Handle) -> BackendResult { // This actually can't be factored out into a nice constructor method, // because the borrow checker needs to be able to see that the borrows @@ -1741,6 +1720,25 @@ impl Writer { } } +struct WriterTypeContext<'m> { + module: &'m Module, + names: &'m crate::FastHashMap, +} + +impl TypeContext for WriterTypeContext<'_> { + fn lookup_type(&self, handle: Handle) -> &crate::Type { + &self.module.types[handle] + } + + fn type_name(&self, handle: Handle) -> &str { + self.names[&NameKey::Type(handle)].as_str() + } + + fn write_override(&self, _: Handle, _: &mut W) -> core::fmt::Result { + unreachable!("overrides should be validated out"); + } +} + fn map_binding_to_attribute(binding: &crate::Binding) -> Vec { match *binding { crate::Binding::BuiltIn(built_in) => {