@zigc/lib 0.17.0-dev.224 → 0.17.0-dev.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/c/math.zig +31 -2
  2. package/compiler/build_runner.zig +1 -1
  3. package/compiler/reduce/Walk.zig +1 -6
  4. package/compiler/resinator/compile.zig +1 -1
  5. package/compiler/resinator/cvtres.zig +4 -4
  6. package/compiler/resinator/ico.zig +4 -4
  7. package/compiler/resinator/parse.zig +2 -2
  8. package/compiler/resinator/res.zig +1 -1
  9. package/compiler/translate-c/ast.zig +11 -21
  10. package/compiler_rt/atomics.zig +1 -1
  11. package/compiler_rt/cos.zig +1 -1
  12. package/compiler_rt/rem_pio2l.zig +1 -1
  13. package/compiler_rt/sin.zig +1 -1
  14. package/compiler_rt/sincos.zig +1 -1
  15. package/compiler_rt/ssp.zig +2 -2
  16. package/compiler_rt/tan.zig +1 -1
  17. package/docs/wasm/Walk.zig +1 -3
  18. package/docs/wasm/html_render.zig +1 -2
  19. package/package.json +1 -1
  20. package/std/Build/Step/ConfigHeader.zig +1 -1
  21. package/std/Io/Kqueue.zig +1 -1
  22. package/std/Io/Reader.zig +0 -5
  23. package/std/Io/Threaded.zig +4 -4
  24. package/std/Io/Writer.zig +1 -2
  25. package/std/Io/net/HostName.zig +11 -6
  26. package/std/Random/ChaCha.zig +2 -2
  27. package/std/Random/benchmark.zig +2 -2
  28. package/std/Thread.zig +2 -2
  29. package/std/base64.zig +5 -5
  30. package/std/bit_set.zig +83 -66
  31. package/std/c.zig +19 -19
  32. package/std/compress/flate/Decompress.zig +1 -1
  33. package/std/crypto/25519/curve25519.zig +2 -2
  34. package/std/crypto/25519/edwards25519.zig +3 -3
  35. package/std/crypto/25519/ristretto255.zig +2 -2
  36. package/std/crypto/25519/scalar.zig +6 -6
  37. package/std/crypto/25519/x25519.zig +1 -1
  38. package/std/crypto/Certificate.zig +1 -1
  39. package/std/crypto/Sha1.zig +1 -1
  40. package/std/crypto/aegis.zig +45 -39
  41. package/std/crypto/aes_ccm.zig +20 -20
  42. package/std/crypto/aes_gcm.zig +10 -12
  43. package/std/crypto/aes_ocb.zig +9 -9
  44. package/std/crypto/argon2.zig +15 -15
  45. package/std/crypto/bcrypt.zig +20 -10
  46. package/std/crypto/benchmark.zig +7 -7
  47. package/std/crypto/blake2.zig +100 -64
  48. package/std/crypto/cbc_mac.zig +1 -1
  49. package/std/crypto/chacha20.zig +10 -10
  50. package/std/crypto/cmac.zig +2 -2
  51. package/std/crypto/codecs/asn1.zig +1 -1
  52. package/std/crypto/codecs/base64_hex_ct.zig +1 -1
  53. package/std/crypto/ecdsa.zig +9 -9
  54. package/std/crypto/ff.zig +2 -2
  55. package/std/crypto/ghash_polyval.zig +4 -4
  56. package/std/crypto/hkdf.zig +1 -1
  57. package/std/crypto/isap.zig +3 -3
  58. package/std/crypto/kangarootwelve.zig +1 -1
  59. package/std/crypto/keccak_p.zig +7 -7
  60. package/std/crypto/md5.zig +1 -1
  61. package/std/crypto/ml_dsa.zig +33 -33
  62. package/std/crypto/ml_kem.zig +4 -4
  63. package/std/crypto/modes.zig +1 -1
  64. package/std/crypto/pbkdf2.zig +1 -1
  65. package/std/crypto/pcurves/p256/scalar.zig +3 -3
  66. package/std/crypto/pcurves/p384/scalar.zig +2 -2
  67. package/std/crypto/pcurves/secp256k1/scalar.zig +3 -3
  68. package/std/crypto/pcurves/tests/p256.zig +5 -5
  69. package/std/crypto/pcurves/tests/p384.zig +5 -5
  70. package/std/crypto/pcurves/tests/secp256k1.zig +3 -3
  71. package/std/crypto/salsa20.zig +8 -8
  72. package/std/crypto/sha2.zig +2 -2
  73. package/std/crypto/sha3.zig +2 -2
  74. package/std/crypto/siphash.zig +1 -1
  75. package/std/crypto/timing_safe.zig +5 -4
  76. package/std/crypto/tls/Client.zig +10 -9
  77. package/std/crypto.zig +3 -3
  78. package/std/debug/Dwarf.zig +1 -1
  79. package/std/debug.zig +6 -4
  80. package/std/elf.zig +1 -1
  81. package/std/enums.zig +3 -3
  82. package/std/fmt/parse_float/decimal.zig +1 -1
  83. package/std/fmt.zig +5 -1
  84. package/std/fs/path.zig +1 -1
  85. package/std/hash/Adler32.zig +3 -3
  86. package/std/hash/benchmark.zig +2 -2
  87. package/std/hash/wyhash.zig +1 -1
  88. package/std/heap/debug_allocator.zig +1 -1
  89. package/std/http.zig +1 -1
  90. package/std/json/static.zig +2 -2
  91. package/std/math/big/int.zig +3 -3
  92. package/std/math/float.zig +62 -0
  93. package/std/math/nextafter.zig +1 -2
  94. package/std/math/powi.zig +2 -3
  95. package/std/math/signbit.zig +0 -1
  96. package/std/math.zig +13 -18
  97. package/std/mem.zig +9 -8
  98. package/std/meta.zig +1 -1
  99. package/std/os/emscripten.zig +2 -2
  100. package/std/os/linux.zig +4 -4
  101. package/std/os/uefi/hii.zig +1 -1
  102. package/std/std.zig +3 -0
  103. package/std/tar/Writer.zig +39 -33
  104. package/std/tar.zig +8 -4
  105. package/std/testing.zig +1 -1
  106. package/std/unicode.zig +13 -8
  107. package/std/zig/Ast/Render.zig +1 -25
  108. package/std/zig/Ast.zig +5 -28
  109. package/std/zig/AstGen.zig +75 -184
  110. package/std/zig/AstRlAnnotate.zig +1 -11
  111. package/std/zig/AstSmith.zig +5 -11
  112. package/std/zig/LibCInstallation.zig +1 -1
  113. package/std/zig/Parse.zig +4 -69
  114. package/std/zig/TokenSmith.zig +0 -6
  115. package/std/zig/WindowsSdk.zig +1 -1
  116. package/std/zig/Zir.zig +0 -54
  117. package/std/zig/ZonGen.zig +0 -1
  118. package/std/zig/llvm/Builder.zig +3 -7
  119. package/std/zig/tokenizer.zig +4 -43
  120. package/std/zig.zig +0 -2
  121. package/compiler_rt/long_double.zig +0 -37
  122. package/libc/mingw/math/lrintl.c +0 -18
  123. package/libc/mingw/math/rintl.c +0 -16
  124. package/libc/musl/src/math/i386/lrintl.c +0 -8
  125. package/libc/musl/src/math/i386/rintl.c +0 -7
  126. package/libc/musl/src/math/lrintl.c +0 -36
  127. package/libc/musl/src/math/rintl.c +0 -29
  128. package/libc/musl/src/math/s390x/rintl.c +0 -15
  129. package/libc/musl/src/math/x32/lrintl.s +0 -7
  130. package/libc/musl/src/math/x32/rintl.s +0 -6
  131. package/libc/musl/src/math/x86_64/lrintl.c +0 -8
  132. package/libc/musl/src/math/x86_64/rintl.c +0 -7
@@ -373,7 +373,7 @@ pub const rusage = extern struct {
373
373
  nsignals: isize,
374
374
  nvcsw: isize,
375
375
  nivcsw: isize,
376
- __reserved: [16]isize = [1]isize{0} ** 16,
376
+ __reserved: [16]isize = @splat(0),
377
377
 
378
378
  pub const SELF = 0;
379
379
  pub const CHILDREN = -1;
@@ -481,7 +481,7 @@ pub const Sigaction = extern struct {
481
481
 
482
482
  pub const sigset_t = [1024 / 32]u32;
483
483
  pub fn sigemptyset() sigset_t {
484
- return [_]u32{0} ** @typeInfo(sigset_t).array.len;
484
+ return @splat(0);
485
485
  }
486
486
  pub const siginfo_t = extern struct {
487
487
  signo: i32,
package/std/os/linux.zig CHANGED
@@ -2262,12 +2262,12 @@ pub fn sigrtmax() u8 {
2262
2262
 
2263
2263
  /// Zig's version of sigemptyset. Returns initialized sigset_t.
2264
2264
  pub fn sigemptyset() sigset_t {
2265
- return [_]SigsetElement{0} ** sigset_len;
2265
+ return @splat(0);
2266
2266
  }
2267
2267
 
2268
2268
  /// Zig's version of sigfillset. Returns initalized sigset_t.
2269
2269
  pub fn sigfillset() sigset_t {
2270
- return [_]SigsetElement{~@as(SigsetElement, 0)} ** sigset_len;
2270
+ return @splat(~@as(SigsetElement, 0));
2271
2271
  }
2272
2272
 
2273
2273
  fn sigset_bit_index(sig: SIG) struct { word: usize, mask: SigsetElement } {
@@ -6129,7 +6129,7 @@ pub const sockaddr = extern struct {
6129
6129
  flags: u8,
6130
6130
 
6131
6131
  /// The total size of this structure should be exactly the same as that of struct sockaddr.
6132
- zero: [3]u8 = [_]u8{0} ** 3,
6132
+ zero: [3]u8 = @splat(0),
6133
6133
  comptime {
6134
6134
  std.debug.assert(@sizeOf(vm) == @sizeOf(sockaddr));
6135
6135
  }
@@ -7475,7 +7475,7 @@ pub const rusage = extern struct {
7475
7475
  nsignals: isize,
7476
7476
  nvcsw: isize,
7477
7477
  nivcsw: isize,
7478
- __reserved: [16]isize = [1]isize{0} ** 16,
7478
+ __reserved: [16]isize = @splat(0),
7479
7479
 
7480
7480
  pub const SELF = 0;
7481
7481
  pub const CHILDREN = -1;
@@ -66,7 +66,7 @@ pub const WideGlyph = extern struct {
66
66
  attributes: WideGlyphAttributes,
67
67
  glyph_col_1: [19]u8,
68
68
  glyph_col_2: [19]u8,
69
- _pad: [3]u8 = [_]u8{0} ** 3,
69
+ _pad: [3]u8 = @splat(0),
70
70
  };
71
71
 
72
72
  pub const StringPackage = extern struct {
package/std/std.zig CHANGED
@@ -9,7 +9,9 @@ pub const StaticStringMapWithEql = static_string_map.StaticStringMapWithEql;
9
9
  pub const Deque = @import("deque.zig").Deque;
10
10
  pub const DoublyLinkedList = @import("DoublyLinkedList.zig");
11
11
  pub const DynLib = @import("dynamic_library.zig").DynLib;
12
+ /// Deprecated: use `bit_set.DynamicManaged`.
12
13
  pub const DynamicBitSet = bit_set.DynamicBitSet;
14
+ /// Deprecated: use `bit_set.Dynamic`.
13
15
  pub const DynamicBitSetUnmanaged = bit_set.DynamicBitSetUnmanaged;
14
16
  pub const EnumArray = enums.EnumArray;
15
17
  pub const EnumMap = enums.EnumMap;
@@ -24,6 +26,7 @@ pub const Progress = @import("Progress.zig");
24
26
  pub const Random = @import("Random.zig");
25
27
  pub const SemanticVersion = @import("SemanticVersion.zig");
26
28
  pub const SinglyLinkedList = @import("SinglyLinkedList.zig");
29
+ /// Deprecated: use `bit_set.Static`.
27
30
  pub const StaticBitSet = bit_set.StaticBitSet;
28
31
  pub const StringHashMap = hash_map.StringHashMap;
29
32
  pub const StringHashMapUnmanaged = hash_map.StringHashMapUnmanaged;
@@ -193,23 +193,23 @@ pub const Header = extern struct {
193
193
  // numeric field of width w contains w minus 1 digits, and a null.
194
194
  // Reference: https://www.gnu.org/software/tar/manual/html_node/Standard.html
195
195
  // POSIX header: byte offset
196
- name: [100]u8 = [_]u8{0} ** 100, // 0
196
+ name: [100]u8 = @splat(0), // 0
197
197
  mode: [7:0]u8 = default_mode.file, // 100
198
- uid: [7:0]u8 = [_:0]u8{0} ** 7, // unused 108
199
- gid: [7:0]u8 = [_:0]u8{0} ** 7, // unused 116
200
- size: [11:0]u8 = [_:0]u8{'0'} ** 11, // 124
201
- mtime: [11:0]u8 = [_:0]u8{'0'} ** 11, // 136
202
- checksum: [7:0]u8 = [_:0]u8{' '} ** 7, // 148
198
+ uid: [7:0]u8 = @splat(0), // unused 108
199
+ gid: [7:0]u8 = @splat(0), // unused 116
200
+ size: [11:0]u8 = @splat('0'), // 124
201
+ mtime: [11:0]u8 = @splat('0'), // 136
202
+ checksum: [7:0]u8 = @splat(' '), // 148
203
203
  typeflag: FileType = .regular, // 156
204
- linkname: [100]u8 = [_]u8{0} ** 100, // 157
205
- magic: [6]u8 = [_]u8{ 'u', 's', 't', 'a', 'r', 0 }, // 257
206
- version: [2]u8 = [_]u8{ '0', '0' }, // 263
207
- uname: [32]u8 = [_]u8{0} ** 32, // unused 265
208
- gname: [32]u8 = [_]u8{0} ** 32, // unused 297
209
- devmajor: [7:0]u8 = [_:0]u8{0} ** 7, // unused 329
210
- devminor: [7:0]u8 = [_:0]u8{0} ** 7, // unused 337
211
- prefix: [155]u8 = [_]u8{0} ** 155, // 345
212
- pad: [12]u8 = [_]u8{0} ** 12, // unused 500
204
+ linkname: [100]u8 = @splat(0), // 157
205
+ magic: [6]u8 = .{ 'u', 's', 't', 'a', 'r', 0 }, // 257
206
+ version: [2]u8 = .{ '0', '0' }, // 263
207
+ uname: [32]u8 = @splat(0), // unused 265
208
+ gname: [32]u8 = @splat(0), // unused 297
209
+ devmajor: [7:0]u8 = @splat(0), // unused 329
210
+ devminor: [7:0]u8 = @splat(0), // unused 337
211
+ prefix: [155]u8 = @splat(0), // 345
212
+ pad: [12]u8 = @splat(0), // unused 500
213
213
 
214
214
  pub const FileType = enum(u8) {
215
215
  regular = '0',
@@ -342,26 +342,26 @@ pub const Header = extern struct {
342
342
  },
343
343
  // no more both fits into name
344
344
  .{
345
- .in = &.{ "prefix", "0123456789/" ** 8 ++ "basename" },
346
- .out = &.{ "prefix", "0123456789/" ** 8 ++ "basename" },
345
+ .in = &.{ "prefix", repeatString(8, "0123456789/") ++ "basename" },
346
+ .out = &.{ "prefix", repeatString(8, "0123456789/") ++ "basename" },
347
347
  },
348
348
  // put as much as you can into prefix the rest goes into name
349
349
  .{
350
- .in = &.{ "prefix", "0123456789/" ** 10 ++ "basename" },
351
- .out = &.{ "prefix/" ++ "0123456789/" ** 9 ++ "0123456789", "basename" },
350
+ .in = &.{ "prefix", repeatString(10, "0123456789/") ++ "basename" },
351
+ .out = &.{ "prefix/" ++ repeatString(9, "0123456789/") ++ "0123456789", "basename" },
352
352
  },
353
353
 
354
354
  .{
355
- .in = &.{ "prefix", "0123456789/" ** 15 ++ "basename" },
356
- .out = &.{ "prefix/" ++ "0123456789/" ** 12 ++ "0123456789", "0123456789/0123456789/basename" },
355
+ .in = &.{ "prefix", repeatString(15, "0123456789/") ++ "basename" },
356
+ .out = &.{ "prefix/" ++ repeatString(12, "0123456789/") ++ "0123456789", "0123456789/0123456789/basename" },
357
357
  },
358
358
  .{
359
- .in = &.{ "prefix", "0123456789/" ** 21 ++ "basename" },
360
- .out = &.{ "prefix/" ++ "0123456789/" ** 12 ++ "0123456789", "0123456789/" ** 8 ++ "basename" },
359
+ .in = &.{ "prefix", repeatString(21, "0123456789/") ++ "basename" },
360
+ .out = &.{ "prefix/" ++ repeatString(12, "0123456789/") ++ "0123456789", repeatString(8, "0123456789/") ++ "basename" },
361
361
  },
362
362
  .{
363
- .in = &.{ "", "012345678/" ** 10 ++ "foo" },
364
- .out = &.{ "012345678/" ** 9 ++ "012345678", "foo" },
363
+ .in = &.{ "", repeatString(10, "012345678/") ++ "foo" },
364
+ .out = &.{ repeatString(9, "012345678/") ++ "012345678", "foo" },
365
365
  },
366
366
  };
367
367
 
@@ -378,10 +378,10 @@ pub const Header = extern struct {
378
378
  // basename can't fit into name (106 characters)
379
379
  .{ .in = &.{ "zig", "test/cases/compile_errors/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig" } },
380
380
  // cant fit into 255 + sep
381
- .{ .in = &.{ "prefix", "0123456789/" ** 22 ++ "basename" } },
381
+ .{ .in = &.{ "prefix", repeatString(22, "0123456789/") ++ "basename" } },
382
382
  // can fit but sub_path can't be split (there is no separator)
383
- .{ .in = &.{ "prefix", "0123456789" ** 10 ++ "a" } },
384
- .{ .in = &.{ "prefix", "0123456789" ** 14 ++ "basename" } },
383
+ .{ .in = &.{ "prefix", repeatString(10, "0123456789") ++ "a" } },
384
+ .{ .in = &.{ "prefix", repeatString(14, "0123456789") ++ "basename" } },
385
385
  };
386
386
 
387
387
  for (error_cases) |case| {
@@ -404,11 +404,11 @@ test "write files" {
404
404
  content: []const u8,
405
405
  }{
406
406
  .{ .path = "foo", .content = "bar" },
407
- .{ .path = "a12345678/" ** 10 ++ "foo", .content = "a" ** 511 },
408
- .{ .path = "b12345678/" ** 24 ++ "foo", .content = "b" ** 512 },
409
- .{ .path = "c12345678/" ** 25 ++ "foo", .content = "c" ** 513 },
410
- .{ .path = "d12345678/" ** 51 ++ "foo", .content = "d" ** 1025 },
411
- .{ .path = "e123456789" ** 11, .content = "e" },
407
+ .{ .path = repeatString(10, "a12345678/") ++ "foo", .content = repeatString(511, "a") },
408
+ .{ .path = repeatString(24, "b12345678/") ++ "foo", .content = repeatString(512, "b") },
409
+ .{ .path = repeatString(25, "c12345678/") ++ "foo", .content = repeatString(513, "c") },
410
+ .{ .path = repeatString(51, "d12345678/") ++ "foo", .content = repeatString(1025, "d") },
411
+ .{ .path = repeatString(11, "e123456789"), .content = "e" },
412
412
  };
413
413
 
414
414
  var file_name_buffer: [std.fs.max_path_bytes]u8 = undefined;
@@ -482,3 +482,9 @@ test "write files" {
482
482
  try w.finishPedantically();
483
483
  }
484
484
  }
485
+
486
+ /// Marked `inline` to avoid unnecessary binary float, since arguments are always comptime-known.
487
+ inline fn repeatString(comptime n: usize, comptime str: []const u8) []const u8 {
488
+ const buf: [n][str.len]u8 = @splat(str[0..str.len].*);
489
+ return @ptrCast(&buf);
490
+ }
package/std/tar.zig CHANGED
@@ -734,6 +734,10 @@ test PaxIterator {
734
734
  value: []const u8 = undefined,
735
735
  err: ?anyerror = null,
736
736
  };
737
+ const long_path: *const [1000]u8 = comptime path: {
738
+ const buf: [100][10]u8 = @splat("0123456789".*);
739
+ break :path @ptrCast(&buf);
740
+ };
737
741
  const cases = [_]struct {
738
742
  data: []const u8,
739
743
  attrs: []const Attr,
@@ -816,9 +820,9 @@ test PaxIterator {
816
820
  },
817
821
  },
818
822
  .{ // 1000 characters path
819
- .data = "1011 path=" ++ "0123456789" ** 100 ++ "\n",
823
+ .data = "1011 path=" ++ long_path ++ "\n",
820
824
  .attrs = &[_]Attr{
821
- .{ .kind = .path, .value = "0123456789" ** 100 },
825
+ .{ .kind = .path, .value = long_path },
822
826
  },
823
827
  },
824
828
  };
@@ -879,7 +883,7 @@ test "header parse size" {
879
883
  };
880
884
 
881
885
  for (cases) |case| {
882
- var bytes = [_]u8{0} ** Header.SIZE;
886
+ var bytes: [Header.SIZE]u8 = @splat(0);
883
887
  @memcpy(bytes[124 .. 124 + case.in.len], case.in);
884
888
  var header = Header{ .bytes = &bytes };
885
889
  if (case.err) |err| {
@@ -904,7 +908,7 @@ test "header parse mode" {
904
908
  .{ .in = "777777777777", .want = 0o77777777 },
905
909
  };
906
910
  for (cases) |case| {
907
- var bytes = [_]u8{0} ** Header.SIZE;
911
+ var bytes: [Header.SIZE]u8 = @splat(0);
908
912
  @memcpy(bytes[100 .. 100 + case.in.len], case.in);
909
913
  var header = Header{ .bytes = &bytes };
910
914
  if (case.err) |err| {
package/std/testing.zig CHANGED
@@ -501,7 +501,7 @@ const BytesDiffer = struct {
501
501
  var row: usize = 0;
502
502
  while (expected_iterator.next()) |chunk| {
503
503
  // to avoid having to calculate diffs twice per chunk
504
- var diffs: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 };
504
+ var diffs: std.bit_set.Integer(16) = .{ .mask = 0 };
505
505
  for (chunk, 0..) |byte, col| {
506
506
  const absolute_byte_index = col + row * 16;
507
507
  const diff = if (absolute_byte_index < self.actual.len) self.actual[absolute_byte_index] != byte else true;
package/std/unicode.zig CHANGED
@@ -275,11 +275,16 @@ fn utf8ValidateSliceImpl(input: []const u8, comptime surrogates: Surrogates) boo
275
275
  const s7 = 0x44; // accept 4, size 4
276
276
 
277
277
  // Information about the first byte in a UTF-8 sequence.
278
- const first = comptime ([_]u8{as} ** 128) ++ ([_]u8{xx} ** 64) ++ [_]u8{
279
- xx, xx, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1,
280
- s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1,
281
- s2, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s4, s3, s3,
282
- s5, s6, s6, s6, s7, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
278
+ const first = comptime first: {
279
+ const a: [128]u8 = @splat(as);
280
+ const b: [64]u8 = @splat(xx);
281
+ const c: [64]u8 = .{
282
+ xx, xx, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1,
283
+ s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1,
284
+ s2, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s4, s3, s3,
285
+ s5, s6, s6, s6, s7, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
286
+ };
287
+ break :first a ++ b ++ c;
283
288
  };
284
289
 
285
290
  const n = remaining.len;
@@ -647,7 +652,7 @@ test "validate slice" {
647
652
 
648
653
  // We skip a variable (based on recommended vector size) chunks of
649
654
  // ASCII characters. Let's make sure we're chunking correctly.
650
- const str = [_]u8{'a'} ** 550 ++ "\xc0";
655
+ const str = @as([550]u8, @splat('a')) ++ "\xc0";
651
656
  for (0..str.len - 3) |i| {
652
657
  try testing.expect(!utf8ValidateSlice(str[i..]));
653
658
  }
@@ -1394,7 +1399,7 @@ test "ArrayList functions on a re-used list" {
1394
1399
  fn utf8ToUtf16LeStringLiteralImpl(comptime utf8: []const u8, comptime surrogates: Surrogates) *const [calcUtf16LeLenImpl(utf8, surrogates) catch |err| @compileError(err):0]u16 {
1395
1400
  return comptime blk: {
1396
1401
  const len: usize = calcUtf16LeLenImpl(utf8, surrogates) catch unreachable;
1397
- var utf16le: [len:0]u16 = [_:0]u16{0} ** len;
1402
+ var utf16le: [len:0]u16 = @splat(0);
1398
1403
  const utf16le_len = utf8ToUtf16LeImpl(&utf16le, utf8[0..], surrogates) catch |err| @compileError(err);
1399
1404
  assert(len == utf16le_len);
1400
1405
  const final = utf16le;
@@ -1640,7 +1645,7 @@ test "validate WTF-8 slice" {
1640
1645
 
1641
1646
  // We skip a variable (based on recommended vector size) chunks of
1642
1647
  // ASCII characters. Let's make sure we're chunking correctly.
1643
- const str = [_]u8{'a'} ** 550 ++ "\xc0";
1648
+ const str = @as([550]u8, @splat('a')) ++ "\xc0";
1644
1649
  for (0..str.len - 3) |i| {
1645
1650
  try testing.expect(!wtf8ValidateSlice(str[i..]));
1646
1651
  }
@@ -394,20 +394,8 @@ fn renderExpression(r: *Render, node: Ast.Node.Index, space: Space) Error!void {
394
394
  return renderBlock(r, node, statements, space);
395
395
  },
396
396
 
397
- .@"errdefer" => {
398
- const defer_token = tree.nodeMainToken(node);
399
- const maybe_payload_token, const expr = tree.nodeData(node).opt_token_and_node;
400
-
401
- try renderToken(r, defer_token, .maybe_space);
402
- if (maybe_payload_token.unwrap()) |payload_token| {
403
- try renderToken(r, payload_token - 1, .none); // |
404
- try renderIdentifier(r, payload_token, .none, .preserve_when_shadowing); // identifier
405
- try renderToken(r, payload_token + 1, .maybe_space); // |
406
- }
407
- return renderExpression(r, expr, space);
408
- },
409
-
410
397
  .@"defer",
398
+ .@"errdefer",
411
399
  .@"comptime",
412
400
  .@"nosuspend",
413
401
  .@"suspend",
@@ -520,7 +508,6 @@ fn renderExpression(r: *Render, node: Ast.Node.Index, space: Space) Error!void {
520
508
  .add_wrap,
521
509
  .add_sat,
522
510
  .array_cat,
523
- .array_mult,
524
511
  .bang_equal,
525
512
  .bit_and,
526
513
  .bit_or,
@@ -1040,16 +1027,6 @@ fn renderPtrType(r: *Render, ptr_type: Ast.full.PtrType, space: Space) Error!voi
1040
1027
 
1041
1028
  switch (ptr_type.size) {
1042
1029
  .one => {
1043
- // Since ** tokens exist and the same token is shared by two
1044
- // nested pointer types, we check to see if we are the parent
1045
- // in such a relationship. If so, skip rendering anything for
1046
- // this pointer type and rely on the child to render our asterisk
1047
- // as well when it renders the ** token.
1048
- if (tree.tokenTag(main_token) == .asterisk_asterisk and
1049
- main_token == tree.nodeMainToken(ptr_type.ast.child_type))
1050
- {
1051
- return renderExpression(r, ptr_type.ast.child_type, space);
1052
- }
1053
1030
  try renderToken(r, main_token, .none); // asterisk
1054
1031
  },
1055
1032
  .many => {
@@ -3235,7 +3212,6 @@ fn nodeCausesSliceOpSpace(tag: Ast.Node.Tag) bool {
3235
3212
  .add,
3236
3213
  .add_wrap,
3237
3214
  .array_cat,
3238
- .array_mult,
3239
3215
  .assign,
3240
3216
  .assign_bit_and,
3241
3217
  .assign_bit_or,
package/std/zig/Ast.zig CHANGED
@@ -331,11 +331,6 @@ pub fn rootDecls(tree: Ast) []const Node.Index {
331
331
 
332
332
  pub fn renderError(tree: Ast, parse_error: Error, w: *Writer) Writer.Error!void {
333
333
  switch (parse_error.tag) {
334
- .asterisk_after_ptr_deref => {
335
- // Note that the token will point at the `.*` but ideally the source
336
- // location would point to the `*` after the `.*`.
337
- return w.writeAll("'.*' cannot be followed by '*'; are you missing a space?");
338
- },
339
334
  .chained_comparison_operators => {
340
335
  return w.writeAll("comparison operators cannot be chained");
341
336
  },
@@ -687,7 +682,6 @@ pub fn firstToken(tree: Ast, node: Node.Index) TokenIndex {
687
682
  .mul,
688
683
  .div,
689
684
  .mod,
690
- .array_mult,
691
685
  .mul_wrap,
692
686
  .mul_sat,
693
687
  .add,
@@ -924,7 +918,6 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex {
924
918
  .mul,
925
919
  .div,
926
920
  .mod,
927
- .array_mult,
928
921
  .mul_wrap,
929
922
  .mul_sat,
930
923
  .add,
@@ -952,8 +945,8 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex {
952
945
  .switch_range,
953
946
  => n = tree.nodeData(n).node_and_node[1],
954
947
 
955
- .test_decl, .@"errdefer" => n = tree.nodeData(n).opt_token_and_node[1],
956
- .@"defer" => n = tree.nodeData(n).node,
948
+ .test_decl => n = tree.nodeData(n).opt_token_and_node[1],
949
+ .@"defer", .@"errdefer" => n = tree.nodeData(n).node,
957
950
  .anyframe_type => n = tree.nodeData(n).token_and_node[1],
958
951
 
959
952
  .switch_case_one,
@@ -2111,9 +2104,7 @@ fn fullFnProtoComponents(tree: Ast, info: full.FnProto.Components) full.FnProto
2111
2104
 
2112
2105
  fn fullPtrTypeComponents(tree: Ast, info: full.PtrType.Components) full.PtrType {
2113
2106
  const size: std.builtin.Type.Pointer.Size = switch (tree.tokenTag(info.main_token)) {
2114
- .asterisk,
2115
- .asterisk_asterisk,
2116
- => .one,
2107
+ .asterisk => .one,
2117
2108
  .l_bracket => switch (tree.tokenTag(info.main_token + 1)) {
2118
2109
  .asterisk => if (tree.tokenTag(info.main_token + 2) == .identifier) .c else .many,
2119
2110
  else => .slice,
@@ -2842,7 +2833,6 @@ pub const Error = struct {
2842
2833
  } = .{ .none = {} },
2843
2834
 
2844
2835
  pub const Tag = enum {
2845
- asterisk_after_ptr_deref,
2846
2836
  chained_comparison_operators,
2847
2837
  decl_between_fields,
2848
2838
  expected_block,
@@ -3059,11 +3049,8 @@ pub const Node = struct {
3059
3049
  /// a `assign_destructure` node or a parsing error occured.
3060
3050
  aligned_var_decl,
3061
3051
  /// `errdefer expr`,
3062
- /// `errdefer |payload| expr`.
3063
3052
  ///
3064
- /// The `data` field is a `.opt_token_and_node`:
3065
- /// 1. a `OptionalTokenIndex` to the payload identifier, if any.
3066
- /// 2. a `Node.Index` to the deferred expression.
3053
+ /// The `data` field is a `.node` to the deferred expression.
3067
3054
  ///
3068
3055
  /// The `main_token` field is the `errdefer` token.
3069
3056
  @"errdefer",
@@ -3071,7 +3058,7 @@ pub const Node = struct {
3071
3058
  ///
3072
3059
  /// The `data` field is a `.node` to the deferred expression.
3073
3060
  ///
3074
- /// The `main_token` field is the `defer`.
3061
+ /// The `main_token` field is the `defer` token.
3075
3062
  @"defer",
3076
3063
  /// `lhs catch rhs`,
3077
3064
  /// `lhs catch |err| rhs`.
@@ -3181,8 +3168,6 @@ pub const Node = struct {
3181
3168
  div,
3182
3169
  /// `lhs % rhs`. The `main_token` field is the `%` token.
3183
3170
  mod,
3184
- /// `lhs ** rhs`. The `main_token` field is the `**` token.
3185
- array_mult,
3186
3171
  /// `lhs *% rhs`. The `main_token` field is the `*%` token.
3187
3172
  mul_wrap,
3188
3173
  /// `lhs *| rhs`. The `main_token` field is the `*|` token.
@@ -3253,8 +3238,6 @@ pub const Node = struct {
3253
3238
  ///
3254
3239
  /// The `main_token` is the asterisk if a single item pointer or the
3255
3240
  /// lbracket if a slice, many-item pointer, or C-pointer.
3256
- /// The `main_token` might be a ** token, which is shared with a
3257
- /// parent/child pointer type and may require special handling.
3258
3241
  ptr_type_aligned,
3259
3242
  /// `[*:lhs]rhs`,
3260
3243
  /// `*rhs`,
@@ -3266,8 +3249,6 @@ pub const Node = struct {
3266
3249
  ///
3267
3250
  /// The `main_token` is the asterisk if a single item pointer or the
3268
3251
  /// lbracket if a slice, many-item pointer, or C-pointer.
3269
- /// The `main_token` might be a ** token, which is shared with a
3270
- /// parent/child pointer type and may require special handling.
3271
3252
  ptr_type_sentinel,
3272
3253
  /// The `data` field is a `.extra_and_node`:
3273
3254
  /// 1. a `ExtraIndex` to `PtrType`.
@@ -3275,8 +3256,6 @@ pub const Node = struct {
3275
3256
  ///
3276
3257
  /// The `main_token` is the asterisk if a single item pointer or the
3277
3258
  /// lbracket if a slice, many-item pointer, or C-pointer.
3278
- /// The `main_token` might be a ** token, which is shared with a
3279
- /// parent/child pointer type and may require special handling.
3280
3259
  ptr_type,
3281
3260
  /// The `data` field is a `.extra_and_node`:
3282
3261
  /// 1. a `ExtraIndex` to `PtrTypeBitRange`.
@@ -3284,8 +3263,6 @@ pub const Node = struct {
3284
3263
  ///
3285
3264
  /// The `main_token` is the asterisk if a single item pointer or the
3286
3265
  /// lbracket if a slice, many-item pointer, or C-pointer.
3287
- /// The `main_token` might be a ** token, which is shared with a
3288
- /// parent/child pointer type and may require special handling.
3289
3266
  ptr_type_bit_range,
3290
3267
  /// `lhs[rhs..]`
3291
3268
  ///