#[solved] Issue with string lists: expected [][] found *const struct{ ... }

1 messages · Page 1 of 1 (latest)

clever swallow
#
const VK_KHR_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_swapchain";
const extensions = &.{VK_KHR_SWAPCHAIN_EXTENSION_NAME};
const String     = [:0]const u8;
const Name       = vk.String;
const List       = []zvk.Device.extensions.Name;

fn runtimeCode () void {
  const exts :zvk.Device.extensions.List= zvk.cfg.device.extensions;
}
error: expected type '[][:0]const u8', found '*const struct{comptime *const [16:0]u8 = "VK_KHR_swapchain"}'

How can I fix this type error?
What even is that struct{comptime ... } about?

empty ivy
#

[][]const T implies the outer slice is mutable, but the outer slice isnt mutable here since its a pointer to a temporary. the *const struct { comptime ...} is what you get out of &.{a, b, c}. since you control List, why not make it []const zvk.Device.extensions.Name, do you need to mutate the outer slice?

clever swallow
#

no need to mutate, just didnt know better

#

let me try