From a76503d5dd4d79fe012feb43ea30165605518729 Mon Sep 17 00:00:00 2001 From: Javier Guerra Date: Sun, 5 Sep 2021 01:09:56 -0500 Subject: [PATCH] mutable 'seed' not accessible across namespace boundary Recent Zig versions flag an error here; a simple fix is to declare a local constant to carry the `len` value. --- src/main.zig | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main.zig b/src/main.zig index 4f25331..2308cb7 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1602,12 +1602,16 @@ pub fn client_connect( a1[32..].* = seed; a2[32..].* = seed; - const KeyExpansionState = struct { - seed: *const [77]u8, - a1: *[32 + seed.len]u8, - a2: *[32 + seed.len]u8, - master_secret: *const [48]u8, - }; + { + const seedlen = seed.len; + + const KeyExpansionState = struct { + seed: *const [77]u8, + a1: *[32 + seedlen]u8, + a2: *[32 + seedlen]u8, + master_secret: *const [48]u8, + }; + } const next_32_bytes = struct { inline fn f(