Also, the reason it didn’t work in your case is because fields
is a local function variable, so you can’t return a pointer to it. However, it worked in the commented-out case because that tuple has a static lifetime since it only contains comptime-known data, so you can return a pointer to it (see Diving deep into anonymous struct literals).
1 Like