@zigc/lib 0.16.0-test.1 → 0.17.0-dev.131

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 (352) hide show
  1. package/LICENSE +19 -0
  2. package/c/fcntl.zig +6 -1
  3. package/c/inttypes.zig +0 -10
  4. package/c/math.zig +138 -114
  5. package/c/pthread.zig +57 -0
  6. package/c/search.zig +1 -27
  7. package/c/stdlib/drand48.zig +0 -57
  8. package/c/stdlib.zig +0 -100
  9. package/c/string.zig +20 -7
  10. package/c/strings.zig +0 -38
  11. package/c/stropts.zig +17 -0
  12. package/c/unistd.zig +27 -26
  13. package/c/wchar.zig +10 -0
  14. package/c.zig +3 -2
  15. package/compiler/aro/aro/Attribute/names.zig +604 -589
  16. package/compiler/aro/aro/Attribute.zig +202 -116
  17. package/compiler/aro/aro/Builtins/common.zig +874 -863
  18. package/compiler/aro/aro/Builtins/eval.zig +15 -7
  19. package/compiler/aro/aro/Builtins.zig +0 -1
  20. package/compiler/aro/aro/CodeGen.zig +8 -7
  21. package/compiler/aro/aro/Compilation.zig +137 -111
  22. package/compiler/aro/aro/Diagnostics.zig +21 -17
  23. package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
  24. package/compiler/aro/aro/Driver.zig +138 -63
  25. package/compiler/aro/aro/LangOpts.zig +12 -2
  26. package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
  27. package/compiler/aro/aro/Parser.zig +352 -153
  28. package/compiler/aro/aro/Pragma.zig +3 -2
  29. package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
  30. package/compiler/aro/aro/Preprocessor.zig +136 -62
  31. package/compiler/aro/aro/Target.zig +17 -12
  32. package/compiler/aro/aro/Tokenizer.zig +31 -14
  33. package/compiler/aro/aro/Toolchain.zig +4 -7
  34. package/compiler/aro/aro/Tree.zig +178 -148
  35. package/compiler/aro/aro/TypeStore.zig +82 -24
  36. package/compiler/aro/aro/Value.zig +13 -17
  37. package/compiler/aro/aro/features.zig +1 -0
  38. package/compiler/aro/aro/pragmas/message.zig +3 -2
  39. package/compiler/aro/aro/pragmas/once.zig +0 -1
  40. package/compiler/aro/aro/record_layout.zig +3 -3
  41. package/compiler/aro/aro/text_literal.zig +3 -2
  42. package/compiler/aro/assembly_backend/x86_64.zig +7 -8
  43. package/compiler/aro/backend/Assembly.zig +1 -2
  44. package/compiler/aro/backend/Interner.zig +2 -2
  45. package/compiler/aro/backend/Ir.zig +100 -92
  46. package/compiler/aro/include/ptrcheck.h +49 -0
  47. package/compiler/aro/main.zig +26 -10
  48. package/compiler/build_runner.zig +1 -2
  49. package/compiler/objdump.zig +93 -0
  50. package/compiler/reduce/Walk.zig +7 -7
  51. package/compiler/reduce.zig +5 -1
  52. package/compiler/resinator/compile.zig +2 -2
  53. package/compiler/resinator/main.zig +7 -1
  54. package/compiler/resinator/preprocess.zig +1 -3
  55. package/compiler/std-docs.zig +8 -1
  56. package/compiler/test_runner.zig +194 -62
  57. package/compiler/translate-c/MacroTranslator.zig +80 -11
  58. package/compiler/translate-c/PatternList.zig +1 -9
  59. package/compiler/translate-c/Scope.zig +43 -6
  60. package/compiler/translate-c/Translator.zig +369 -127
  61. package/compiler/translate-c/ast.zig +19 -11
  62. package/compiler/translate-c/main.zig +76 -17
  63. package/compiler_rt/cos.zig +140 -53
  64. package/compiler_rt/divmodei4.zig +40 -17
  65. package/compiler_rt/exp.zig +1 -6
  66. package/compiler_rt/exp2.zig +1 -6
  67. package/compiler_rt/exp_f128.zig +377 -0
  68. package/compiler_rt/fabs.zig +0 -2
  69. package/compiler_rt/fma.zig +0 -2
  70. package/compiler_rt/fmax.zig +0 -2
  71. package/compiler_rt/fmin.zig +0 -2
  72. package/compiler_rt/fmod.zig +0 -2
  73. package/compiler_rt/limb64.zig +1127 -0
  74. package/compiler_rt/log.zig +0 -2
  75. package/compiler_rt/log10.zig +0 -2
  76. package/compiler_rt/log2.zig +0 -2
  77. package/compiler_rt/long_double.zig +37 -0
  78. package/compiler_rt/mulXi3.zig +1 -1
  79. package/compiler_rt/mulo.zig +6 -1
  80. package/compiler_rt/rem_pio2l.zig +173 -0
  81. package/compiler_rt/round.zig +0 -2
  82. package/compiler_rt/sin.zig +139 -56
  83. package/compiler_rt/sincos.zig +277 -72
  84. package/compiler_rt/sqrt.zig +0 -2
  85. package/compiler_rt/ssp.zig +1 -1
  86. package/compiler_rt/tan.zig +117 -48
  87. package/compiler_rt/trig.zig +256 -6
  88. package/compiler_rt/trunc.zig +0 -2
  89. package/compiler_rt/udivmodei4.zig +28 -0
  90. package/compiler_rt.zig +2 -0
  91. package/fuzzer.zig +857 -307
  92. package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
  93. package/libc/musl/src/math/pow.c +343 -0
  94. package/package.json +1 -1
  95. package/std/Build/Cache.zig +6 -6
  96. package/std/Build/Fuzz.zig +6 -19
  97. package/std/Build/Module.zig +1 -1
  98. package/std/Build/Step/CheckObject.zig +3 -3
  99. package/std/Build/Step/Compile.zig +18 -1
  100. package/std/Build/Step/ConfigHeader.zig +49 -33
  101. package/std/Build/Step/InstallArtifact.zig +18 -0
  102. package/std/Build/Step/Run.zig +538 -89
  103. package/std/Build/Step/TranslateC.zig +0 -6
  104. package/std/Build/Step.zig +10 -19
  105. package/std/Build/WebServer.zig +31 -19
  106. package/std/Build/abi.zig +47 -11
  107. package/std/Build.zig +17 -17
  108. package/std/Io/Dir.zig +7 -2
  109. package/std/Io/Dispatch.zig +5 -13
  110. package/std/Io/File/Reader.zig +3 -1
  111. package/std/Io/File/Writer.zig +8 -6
  112. package/std/Io/File.zig +1 -0
  113. package/std/Io/Kqueue.zig +2 -2
  114. package/std/Io/Reader.zig +8 -9
  115. package/std/Io/Semaphore.zig +112 -17
  116. package/std/Io/Terminal.zig +1 -1
  117. package/std/Io/Threaded.zig +352 -180
  118. package/std/Io/Uring.zig +15 -16
  119. package/std/Io/Writer.zig +46 -42
  120. package/std/Io/net.zig +11 -11
  121. package/std/Io.zig +1052 -20
  122. package/std/SemanticVersion.zig +1 -1
  123. package/std/Target/Query.zig +2 -2
  124. package/std/Target.zig +53 -7
  125. package/std/Thread.zig +8 -3
  126. package/std/array_hash_map.zig +105 -573
  127. package/std/array_list.zig +22 -31
  128. package/std/bit_set.zig +22 -6
  129. package/std/builtin/assembly.zig +68 -0
  130. package/std/builtin.zig +4 -0
  131. package/std/c/haiku.zig +3 -0
  132. package/std/c/serenity.zig +1 -6
  133. package/std/c.zig +106 -24
  134. package/std/compress/flate/Compress.zig +3 -3
  135. package/std/compress/flate/Decompress.zig +2 -3
  136. package/std/compress/zstd/Decompress.zig +2 -4
  137. package/std/crypto/Certificate/Bundle.zig +15 -1
  138. package/std/crypto/Certificate.zig +13 -1
  139. package/std/crypto/ascon.zig +75 -33
  140. package/std/crypto/codecs/asn1/Oid.zig +12 -1
  141. package/std/crypto/codecs/asn1.zig +33 -18
  142. package/std/crypto/codecs/base64_hex_ct.zig +16 -8
  143. package/std/crypto/ml_kem.zig +2 -9
  144. package/std/crypto/tls/Client.zig +79 -4
  145. package/std/crypto/tls.zig +1 -1
  146. package/std/crypto.zig +1 -0
  147. package/std/debug/Dwarf.zig +29 -9
  148. package/std/debug/Info.zig +4 -0
  149. package/std/debug/MachOFile.zig +46 -8
  150. package/std/debug/Pdb.zig +540 -37
  151. package/std/debug/SelfInfo/Elf.zig +19 -18
  152. package/std/debug/SelfInfo/MachO.zig +18 -7
  153. package/std/debug/SelfInfo/Windows.zig +138 -36
  154. package/std/debug.zig +181 -66
  155. package/std/enums.zig +25 -19
  156. package/std/fmt.zig +8 -3
  157. package/std/fs/path.zig +6 -4
  158. package/std/heap/ArenaAllocator.zig +145 -154
  159. package/std/heap/BufferFirstAllocator.zig +165 -0
  160. package/std/heap/debug_allocator.zig +7 -7
  161. package/std/heap.zig +2 -126
  162. package/std/http/Client.zig +31 -30
  163. package/std/http.zig +14 -13
  164. package/std/json/Scanner.zig +2 -2
  165. package/std/json/Stringify.zig +3 -3
  166. package/std/json/dynamic.zig +4 -4
  167. package/std/math/big/int.zig +16 -17
  168. package/std/mem/Allocator.zig +4 -5
  169. package/std/mem.zig +48 -0
  170. package/std/os/emscripten.zig +2 -18
  171. package/std/os/linux/IoUring.zig +2 -0
  172. package/std/os/linux/aarch64.zig +41 -12
  173. package/std/os/linux/arc.zig +173 -0
  174. package/std/os/linux/arm.zig +41 -12
  175. package/std/os/linux/hexagon.zig +33 -11
  176. package/std/os/linux/loongarch32.zig +41 -13
  177. package/std/os/linux/loongarch64.zig +41 -12
  178. package/std/os/linux/m68k.zig +41 -13
  179. package/std/os/linux/mips.zig +67 -36
  180. package/std/os/linux/mips64.zig +60 -29
  181. package/std/os/linux/mipsn32.zig +60 -29
  182. package/std/os/linux/or1k.zig +41 -12
  183. package/std/os/linux/powerpc.zig +41 -12
  184. package/std/os/linux/powerpc64.zig +41 -12
  185. package/std/os/linux/riscv32.zig +41 -12
  186. package/std/os/linux/riscv64.zig +41 -12
  187. package/std/os/linux/s390x.zig +44 -7
  188. package/std/os/linux/sparc64.zig +83 -52
  189. package/std/os/linux/thumb.zig +52 -36
  190. package/std/os/linux/x32.zig +41 -12
  191. package/std/os/linux/x86.zig +42 -13
  192. package/std/os/linux/x86_64.zig +41 -12
  193. package/std/os/linux.zig +419 -438
  194. package/std/os/uefi/tables/boot_services.zig +9 -8
  195. package/std/os/windows.zig +2 -2
  196. package/std/os.zig +41 -0
  197. package/std/pdb.zig +143 -4
  198. package/std/posix.zig +6 -12
  199. package/std/priority_dequeue.zig +13 -12
  200. package/std/priority_queue.zig +5 -4
  201. package/std/process/Child.zig +1 -1
  202. package/std/process/Environ.zig +1 -1
  203. package/std/process.zig +1 -1
  204. package/std/sort.zig +3 -3
  205. package/std/start.zig +17 -4
  206. package/std/std.zig +19 -6
  207. package/std/testing/FailingAllocator.zig +4 -4
  208. package/std/testing/Smith.zig +37 -2
  209. package/std/zig/Ast/Render.zig +187 -459
  210. package/std/zig/Ast.zig +0 -4
  211. package/std/zig/AstGen.zig +86 -103
  212. package/std/zig/AstRlAnnotate.zig +0 -11
  213. package/std/zig/AstSmith.zig +2602 -0
  214. package/std/zig/BuiltinFn.zig +0 -32
  215. package/std/zig/Client.zig +8 -3
  216. package/std/zig/LibCInstallation.zig +4 -3
  217. package/std/zig/Parse.zig +90 -81
  218. package/std/zig/Server.zig +26 -0
  219. package/std/zig/WindowsSdk.zig +13 -13
  220. package/std/zig/Zir.zig +66 -62
  221. package/std/zig/ZonGen.zig +6 -5
  222. package/std/zig/c_translation/helpers.zig +14 -9
  223. package/std/zig/llvm/Builder.zig +119 -60
  224. package/std/zig/system.zig +20 -4
  225. package/std/zig/tokenizer.zig +2 -1
  226. package/std/zig.zig +7 -10
  227. package/std/zip.zig +5 -5
  228. package/zig.h +340 -1
  229. package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
  230. package/libc/mingw/complex/cabs.c +0 -48
  231. package/libc/mingw/complex/cabsf.c +0 -48
  232. package/libc/mingw/complex/cacos.c +0 -50
  233. package/libc/mingw/complex/cacosf.c +0 -50
  234. package/libc/mingw/complex/carg.c +0 -48
  235. package/libc/mingw/complex/cargf.c +0 -48
  236. package/libc/mingw/complex/casin.c +0 -50
  237. package/libc/mingw/complex/casinf.c +0 -50
  238. package/libc/mingw/complex/catan.c +0 -50
  239. package/libc/mingw/complex/catanf.c +0 -50
  240. package/libc/mingw/complex/ccos.c +0 -50
  241. package/libc/mingw/complex/ccosf.c +0 -50
  242. package/libc/mingw/complex/cexp.c +0 -48
  243. package/libc/mingw/complex/cexpf.c +0 -48
  244. package/libc/mingw/complex/cimag.c +0 -48
  245. package/libc/mingw/complex/cimagf.c +0 -48
  246. package/libc/mingw/complex/clog.c +0 -48
  247. package/libc/mingw/complex/clog10.c +0 -49
  248. package/libc/mingw/complex/clog10f.c +0 -49
  249. package/libc/mingw/complex/clogf.c +0 -48
  250. package/libc/mingw/complex/conj.c +0 -48
  251. package/libc/mingw/complex/conjf.c +0 -48
  252. package/libc/mingw/complex/cpow.c +0 -48
  253. package/libc/mingw/complex/cpowf.c +0 -48
  254. package/libc/mingw/complex/cproj.c +0 -48
  255. package/libc/mingw/complex/cprojf.c +0 -48
  256. package/libc/mingw/complex/creal.c +0 -48
  257. package/libc/mingw/complex/crealf.c +0 -48
  258. package/libc/mingw/complex/csin.c +0 -50
  259. package/libc/mingw/complex/csinf.c +0 -50
  260. package/libc/mingw/complex/csqrt.c +0 -48
  261. package/libc/mingw/complex/csqrtf.c +0 -48
  262. package/libc/mingw/complex/ctan.c +0 -50
  263. package/libc/mingw/complex/ctanf.c +0 -50
  264. package/libc/mingw/math/arm/s_rint.c +0 -86
  265. package/libc/mingw/math/arm/s_rintf.c +0 -51
  266. package/libc/mingw/math/arm/sincos.S +0 -30
  267. package/libc/mingw/math/arm-common/sincosl.c +0 -13
  268. package/libc/mingw/math/arm64/rint.c +0 -12
  269. package/libc/mingw/math/arm64/rintf.c +0 -12
  270. package/libc/mingw/math/arm64/sincos.S +0 -32
  271. package/libc/mingw/math/bsd_private_base.h +0 -148
  272. package/libc/mingw/math/fdiml.c +0 -24
  273. package/libc/mingw/math/frexpf.c +0 -13
  274. package/libc/mingw/math/frexpl.c +0 -71
  275. package/libc/mingw/math/x86/acosf.c +0 -29
  276. package/libc/mingw/math/x86/atanf.c +0 -23
  277. package/libc/mingw/math/x86/atanl.c +0 -18
  278. package/libc/mingw/math/x86/cos.def.h +0 -65
  279. package/libc/mingw/math/x86/cosl.c +0 -46
  280. package/libc/mingw/math/x86/cosl_internal.S +0 -55
  281. package/libc/mingw/math/x86/ldexp.c +0 -23
  282. package/libc/mingw/math/x86/scalbn.S +0 -41
  283. package/libc/mingw/math/x86/scalbnf.S +0 -40
  284. package/libc/mingw/math/x86/sin.def.h +0 -65
  285. package/libc/mingw/math/x86/sinl.c +0 -46
  286. package/libc/mingw/math/x86/sinl_internal.S +0 -58
  287. package/libc/mingw/math/x86/tanl.S +0 -62
  288. package/libc/mingw/misc/btowc.c +0 -28
  289. package/libc/mingw/misc/wcstof.c +0 -66
  290. package/libc/mingw/misc/wcstoimax.c +0 -132
  291. package/libc/mingw/misc/wcstoumax.c +0 -126
  292. package/libc/mingw/misc/wctob.c +0 -29
  293. package/libc/mingw/misc/winbs_uint64.c +0 -6
  294. package/libc/mingw/misc/winbs_ulong.c +0 -6
  295. package/libc/mingw/misc/winbs_ushort.c +0 -6
  296. package/libc/mingw/stdio/_Exit.c +0 -10
  297. package/libc/mingw/stdio/_findfirst64i32.c +0 -21
  298. package/libc/mingw/stdio/_findnext64i32.c +0 -21
  299. package/libc/mingw/stdio/_fstat64i32.c +0 -37
  300. package/libc/mingw/stdio/_stat64i32.c +0 -37
  301. package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
  302. package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
  303. package/libc/mingw/stdio/_wstat64i32.c +0 -37
  304. package/libc/mingw/winpthreads/spinlock.c +0 -82
  305. package/libc/musl/src/legacy/isastream.c +0 -7
  306. package/libc/musl/src/legacy/valloc.c +0 -8
  307. package/libc/musl/src/linux/tee.c +0 -8
  308. package/libc/musl/src/math/__cosl.c +0 -96
  309. package/libc/musl/src/math/__sinl.c +0 -78
  310. package/libc/musl/src/math/__tanl.c +0 -143
  311. package/libc/musl/src/math/aarch64/lrint.c +0 -10
  312. package/libc/musl/src/math/aarch64/lrintf.c +0 -10
  313. package/libc/musl/src/math/aarch64/rintf.c +0 -7
  314. package/libc/musl/src/math/cosl.c +0 -39
  315. package/libc/musl/src/math/fdim.c +0 -10
  316. package/libc/musl/src/math/fdimf.c +0 -10
  317. package/libc/musl/src/math/fdiml.c +0 -18
  318. package/libc/musl/src/math/finite.c +0 -7
  319. package/libc/musl/src/math/finitef.c +0 -7
  320. package/libc/musl/src/math/frexp.c +0 -23
  321. package/libc/musl/src/math/frexpf.c +0 -23
  322. package/libc/musl/src/math/frexpl.c +0 -29
  323. package/libc/musl/src/math/i386/lrint.c +0 -8
  324. package/libc/musl/src/math/i386/lrintf.c +0 -8
  325. package/libc/musl/src/math/i386/rintf.c +0 -7
  326. package/libc/musl/src/math/lrint.c +0 -72
  327. package/libc/musl/src/math/lrintf.c +0 -8
  328. package/libc/musl/src/math/powerpc64/lrint.c +0 -16
  329. package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
  330. package/libc/musl/src/math/rintf.c +0 -30
  331. package/libc/musl/src/math/s390x/rintf.c +0 -15
  332. package/libc/musl/src/math/sincosl.c +0 -60
  333. package/libc/musl/src/math/sinl.c +0 -41
  334. package/libc/musl/src/math/tanl.c +0 -29
  335. package/libc/musl/src/math/x32/lrint.s +0 -5
  336. package/libc/musl/src/math/x32/lrintf.s +0 -5
  337. package/libc/musl/src/math/x86_64/lrint.c +0 -8
  338. package/libc/musl/src/math/x86_64/lrintf.c +0 -8
  339. package/libc/musl/src/string/strdup.c +0 -10
  340. package/libc/musl/src/string/strndup.c +0 -12
  341. package/libc/musl/src/string/wcsdup.c +0 -10
  342. package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
  343. package/libc/musl/src/thread/pthread_spin_init.c +0 -6
  344. package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
  345. package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
  346. package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
  347. package/libc/musl/src/unistd/dup2.c +0 -20
  348. package/libc/musl/src/unistd/dup3.c +0 -26
  349. package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
  350. package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
  351. package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
  352. package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
@@ -18,14 +18,12 @@ target: std.Build.ResolvedTarget,
18
18
  optimize: std.builtin.OptimizeMode,
19
19
  output_file: std.Build.GeneratedFile,
20
20
  link_libc: bool,
21
- use_clang: bool,
22
21
 
23
22
  pub const Options = struct {
24
23
  root_source_file: std.Build.LazyPath,
25
24
  target: std.Build.ResolvedTarget,
26
25
  optimize: std.builtin.OptimizeMode,
27
26
  link_libc: bool = true,
28
- use_clang: bool = true,
29
27
  };
30
28
 
31
29
  pub fn create(owner: *std.Build, options: Options) *TranslateC {
@@ -46,7 +44,6 @@ pub fn create(owner: *std.Build, options: Options) *TranslateC {
46
44
  .optimize = options.optimize,
47
45
  .output_file = .{ .step = &translate_c.step },
48
46
  .link_libc = options.link_libc,
49
- .use_clang = options.use_clang,
50
47
  .system_libs = .empty,
51
48
  };
52
49
  source.addStepDependencies(&translate_c.step);
@@ -175,9 +172,6 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
175
172
  if (translate_c.link_libc) {
176
173
  try argv_list.append("-lc");
177
174
  }
178
- if (!translate_c.use_clang) {
179
- try argv_list.append("-fno-clang");
180
- }
181
175
 
182
176
  try argv_list.append("--cache-dir");
183
177
  try argv_list.append(b.cache_root.path orelse ".");
@@ -67,7 +67,7 @@ test_results: TestResults,
67
67
 
68
68
  /// The return address associated with creation of this step that can be useful
69
69
  /// to print along with debugging messages.
70
- debug_stack_trace: std.builtin.StackTrace,
70
+ debug_stack_trace: std.debug.StackTrace,
71
71
 
72
72
  pub const TestResults = struct {
73
73
  /// The total number of tests in the step. Every test has a "status" from the following:
@@ -282,8 +282,7 @@ pub fn make(s: *Step, options: MakeOptions) error{ MakeFailed, MakeSkipped }!voi
282
282
  }
283
283
 
284
284
  make_result catch |err| switch (err) {
285
- error.MakeFailed => return error.MakeFailed,
286
- error.MakeSkipped => return error.MakeSkipped,
285
+ error.MakeFailed, error.MakeSkipped => |e| return e,
287
286
  else => {
288
287
  s.result_error_msgs.append(arena, @errorName(err)) catch @panic("OOM");
289
288
  return error.MakeFailed;
@@ -328,7 +327,7 @@ pub fn cast(step: *Step, comptime T: type) ?*T {
328
327
  /// For debugging purposes, prints identifying information about this Step.
329
328
  pub fn dump(step: *Step, t: Io.Terminal) void {
330
329
  const w = t.writer;
331
- if (step.debug_stack_trace.instruction_addresses.len > 0) {
330
+ if (step.debug_stack_trace.return_addresses.len > 0) {
332
331
  w.print("name: '{s}'. creation stack trace:\n", .{step.name}) catch {};
333
332
  std.debug.writeStackTrace(&step.debug_stack_trace, t) catch {};
334
333
  } else {
@@ -725,19 +724,12 @@ pub inline fn handleChildProcUnsupported(s: *Step) error{ OutOfMemory, MakeFaile
725
724
  /// Asserts that the caller has already populated `s.result_failed_command`.
726
725
  pub fn handleChildProcessTerm(s: *Step, term: std.process.Child.Term) error{ MakeFailed, OutOfMemory }!void {
727
726
  assert(s.result_failed_command != null);
728
- switch (term) {
729
- .exited => |code| {
730
- if (code != 0) {
731
- return s.fail("process exited with error code {d}", .{code});
732
- }
733
- },
734
- .signal => |sig| {
735
- return s.fail("process terminated with signal {t}", .{sig});
736
- },
737
- .stopped, .unknown => {
738
- return s.fail("process terminated unexpectedly", .{});
739
- },
740
- }
727
+ return switch (term) {
728
+ .exited => |code| if (code != 0) s.fail("process exited with error code {d}", .{code}),
729
+ .signal => |sig| s.fail("process terminated with signal {t}", .{sig}),
730
+ .stopped => |sig| s.fail("process stopped with signal {t}", .{sig}),
731
+ .unknown => s.fail("process terminated unexpectedly", .{}),
732
+ };
741
733
  }
742
734
 
743
735
  pub fn allocPrintCmd(
@@ -852,8 +844,7 @@ fn failWithCacheError(
852
844
  });
853
845
  },
854
846
  },
855
- error.OutOfMemory => return error.OutOfMemory,
856
- error.Canceled => return error.Canceled,
847
+ error.OutOfMemory, error.Canceled => |e| return e,
857
848
  error.InvalidFormat => return s.fail("failed to check cache: invalid manifest file format", .{}),
858
849
  }
859
850
  }
@@ -6,7 +6,7 @@ root_prog_node: std.Progress.Node,
6
6
  watch: bool,
7
7
 
8
8
  tcp_server: ?net.Server,
9
- serve_thread: ?std.Thread,
9
+ serve_task: ?Io.Future(Io.Cancelable!void),
10
10
 
11
11
  /// Uses `Io.Clock.awake`.
12
12
  base_timestamp: Io.Timestamp,
@@ -103,7 +103,7 @@ pub fn init(opts: Options) WebServer {
103
103
  .watch = opts.watch,
104
104
 
105
105
  .tcp_server = null,
106
- .serve_thread = null,
106
+ .serve_task = null,
107
107
 
108
108
  .base_timestamp = opts.base_timestamp.raw,
109
109
  .step_names_trailing = step_names_trailing,
@@ -136,9 +136,9 @@ pub fn deinit(ws: *WebServer) void {
136
136
  gpa.free(ws.time_report_msgs);
137
137
  gpa.free(ws.time_report_update_times);
138
138
 
139
- if (ws.serve_thread) |t| {
139
+ if (ws.serve_task) |t| {
140
140
  if (ws.tcp_server) |*s| s.stream.close(io);
141
- t.join();
141
+ t.await();
142
142
  }
143
143
  if (ws.tcp_server) |*s| s.deinit();
144
144
 
@@ -146,15 +146,15 @@ pub fn deinit(ws: *WebServer) void {
146
146
  }
147
147
  pub fn start(ws: *WebServer) error{AlreadyReported}!void {
148
148
  assert(ws.tcp_server == null);
149
- assert(ws.serve_thread == null);
149
+ assert(ws.serve_task == null);
150
150
  const io = ws.graph.io;
151
151
 
152
152
  ws.tcp_server = ws.listen_address.listen(io, .{ .reuse_address = true }) catch |err| {
153
- log.err("failed to listen to port {d}: {s}", .{ ws.listen_address.getPort(), @errorName(err) });
153
+ log.err("failed to listen to port {d}: {t}", .{ ws.listen_address.getPort(), err });
154
154
  return error.AlreadyReported;
155
155
  };
156
- ws.serve_thread = std.Thread.spawn(.{}, serve, .{ws}) catch |err| {
157
- log.err("unable to spawn web server thread: {s}", .{@errorName(err)});
156
+ ws.serve_task = io.concurrent(serve, .{ws}) catch |err| {
157
+ log.err("unable to spawn web server thread: {t}", .{err});
158
158
  ws.tcp_server.?.deinit(io);
159
159
  ws.tcp_server = null;
160
160
  return error.AlreadyReported;
@@ -165,15 +165,20 @@ pub fn start(ws: *WebServer) error{AlreadyReported}!void {
165
165
  log.info("hint: pass '--webui={f}' to use the same port next time", .{ws.tcp_server.?.socket.address});
166
166
  }
167
167
  }
168
- fn serve(ws: *WebServer) void {
168
+ fn serve(ws: *WebServer) Io.Cancelable!void {
169
169
  const io = ws.graph.io;
170
+ var group: Io.Group = .init;
171
+ defer group.cancel(io);
170
172
  while (true) {
171
- var stream = ws.tcp_server.?.accept(io) catch |err| {
172
- log.err("failed to accept connection: {s}", .{@errorName(err)});
173
- return;
173
+ var stream = ws.tcp_server.?.accept(io) catch |err| switch (err) {
174
+ error.Canceled => |e| return e,
175
+ else => |e| {
176
+ log.err("failed to accept connection: {t}", .{e});
177
+ return;
178
+ },
174
179
  };
175
- _ = std.Thread.spawn(.{}, accept, .{ ws, stream }) catch |err| {
176
- log.err("unable to spawn connection thread: {s}", .{@errorName(err)});
180
+ group.concurrent(io, accept, .{ ws, stream }) catch |err| {
181
+ log.err("unable to spawn connection thread: {t}", .{err});
177
182
  stream.close(io);
178
183
  continue;
179
184
  };
@@ -303,8 +308,8 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn {
303
308
  copy.* = @atomicLoad(u8, shared, .monotonic);
304
309
  }
305
310
 
306
- const recv_thread = try std.Thread.spawn(.{}, recvWebSocketMessages, .{ ws, sock });
307
- defer recv_thread.join();
311
+ var recv_thread = try io.concurrent(recvWebSocketMessages, .{ ws, sock });
312
+ defer recv_thread.cancel(io);
308
313
 
309
314
  {
310
315
  const hello_header: abi.Hello = .{
@@ -617,8 +622,8 @@ fn buildClientWasm(ws: *WebServer, arena: Allocator, optimize: std.builtin.Optim
617
622
  defer body_buffer.deinit(gpa);
618
623
 
619
624
  while (true) {
620
- const header = stdout.takeStruct(Header, .little) catch |e| switch (e) {
621
- error.ReadFailed => return error.ReadFailed,
625
+ const header = stdout.takeStruct(Header, .little) catch |err| switch (err) {
626
+ error.ReadFailed => |e| return e,
622
627
  error.EndOfStream => break,
623
628
  };
624
629
  body_buffer.clearRetainingCapacity();
@@ -676,7 +681,14 @@ fn buildClientWasm(ws: *WebServer, arena: Allocator, optimize: std.builtin.Optim
676
681
  );
677
682
  return error.WasmCompilationFailed;
678
683
  },
679
- .stopped, .unknown => {
684
+ .stopped => |sig| {
685
+ log.err(
686
+ "the following command stopped unexpectedly with signal {t}:\n{s}",
687
+ .{ sig, try Build.Step.allocPrintCmd(arena, .inherit, null, argv.items) },
688
+ );
689
+ return error.WasmCompilationFailed;
690
+ },
691
+ .unknown => {
680
692
  log.err(
681
693
  "the following command terminated unexpectedly:\n{s}",
682
694
  .{try Build.Step.allocPrintCmd(arena, .inherit, null, argv.items)},
package/std/Build/abi.zig CHANGED
@@ -162,15 +162,39 @@ pub const fuzz = struct {
162
162
  pub extern fn fuzzer_init(cache_dir_path: Slice) void;
163
163
  /// `fuzzer_init` must be called first.
164
164
  pub extern fn fuzzer_coverage() Coverage;
165
+ pub extern fn fuzzer_unslide_address(addr: usize) usize;
166
+
167
+ /// Performs all the fuzzing work and selects tests to run
168
+ ///
165
169
  /// `fuzzer_init` must be called first.
166
- pub extern fn fuzzer_set_test(test_one: TestOne, unit_test_name: Slice) void;
167
- /// `fuzzer_set_test` must be called first.
168
- /// The callee owns the memory of bytes and must not free it until `fuzzer_main` returns
170
+ pub extern fn fuzzer_main(
171
+ n_tests: u32,
172
+ seed: u32,
173
+ limit_kind: LimitKind,
174
+ amount_or_instance: u64,
175
+ ) void;
176
+ pub extern fn runner_test_run(i: u32) void;
177
+ pub extern fn runner_test_name(i: u32) Slice;
178
+ // Since the runner owns the `std.zig.Server` instance, it also controls the
179
+ // concurrent Io instance so reads can be canceled. As such, the fuzzer has
180
+ // to call into the runner for any zig server / concurrent operation.
181
+ pub extern fn runner_start_input_poller() void;
182
+ pub extern fn runner_stop_input_poller() void;
183
+ /// Returns if cancelation has been indicated.
184
+ pub extern fn runner_futex_wait(*const u32, expected: u32) bool;
185
+ pub extern fn runner_futex_wake(*const u32, waiters: u32) void;
186
+ pub extern fn runner_broadcast_input(test_i: u32, bytes: Slice) void;
187
+ /// `fuzzer_main` must be called first.
188
+ ///
189
+ /// Called concurrently with `fuzzer_main`. Returns if cancelation has been indicated.
190
+ pub extern fn fuzzer_receive_input(test_i: u32, bytes: Slice) bool;
191
+
192
+ /// Must be called from inside a test function
193
+ pub extern fn fuzzer_set_test(test_one: TestOne) void;
194
+ /// Must be called from inside a test function where `fuzzer_set_test` has been called first.
169
195
  pub extern fn fuzzer_new_input(bytes: Slice) void;
170
- /// `fuzzer_set_test` must be called first.
171
- /// Resets the fuzzer's state to that of `fuzzer_init`.
172
- pub extern fn fuzzer_main(limit_kind: LimitKind, amount: u64) void;
173
- pub extern fn fuzzer_unslide_address(addr: usize) usize;
196
+ /// Must be called from inside a test function where `fuzzer_set_test` has been called first.
197
+ pub extern fn fuzzer_start_test() void;
174
198
 
175
199
  pub extern fn fuzzer_int(uid: Uid, weights: Weights) u64;
176
200
  pub extern fn fuzzer_eos(uid: Uid, weights: Weights) bool;
@@ -235,7 +259,8 @@ pub const fuzz = struct {
235
259
  max: u64,
236
260
  weight: u64,
237
261
 
238
- fn intFromValue(x: anytype) u64 {
262
+ /// `inline` to propogate comptimeness
263
+ inline fn intFromValue(x: anytype) u64 {
239
264
  const T = @TypeOf(x);
240
265
  return switch (@typeInfo(T)) {
241
266
  .comptime_int => x,
@@ -269,11 +294,13 @@ pub const fuzz = struct {
269
294
  };
270
295
  }
271
296
 
272
- pub fn value(T: type, x: T, weight: u64) Weight {
297
+ /// `inline` to propogate comptimeness
298
+ pub inline fn value(T: type, x: T, weight: u64) Weight {
273
299
  return .{ .min = intFromValue(x), .max = intFromValue(x), .weight = weight };
274
300
  }
275
301
 
276
- pub fn rangeAtMost(T: type, at_least: T, at_most: T, weight: u64) Weight {
302
+ /// `inline` to propogate comptimeness
303
+ pub inline fn rangeAtMost(T: type, at_least: T, at_most: T, weight: u64) Weight {
277
304
  std.debug.assert(intFromValue(at_least) <= intFromValue(at_most));
278
305
  return .{
279
306
  .min = intFromValue(at_least),
@@ -282,7 +309,8 @@ pub const fuzz = struct {
282
309
  };
283
310
  }
284
311
 
285
- pub fn rangeLessThan(T: type, at_least: T, less_than: T, weight: u64) Weight {
312
+ /// `inline` to propogate comptimeness
313
+ pub inline fn rangeLessThan(T: type, at_least: T, less_than: T, weight: u64) Weight {
286
314
  std.debug.assert(intFromValue(at_least) < intFromValue(less_than));
287
315
  return .{
288
316
  .min = intFromValue(at_least),
@@ -333,6 +361,14 @@ pub const fuzz = struct {
333
361
  }
334
362
  };
335
363
 
364
+ /// Fields are little-endian
365
+ pub const MmapInputHeader = extern struct {
366
+ pc_digest: u64 align(4), // aligned so header does not have padding
367
+ instance_id: u32,
368
+ test_i: u32,
369
+ len: u32,
370
+ };
371
+
336
372
  /// WebSocket server->client.
337
373
  ///
338
374
  /// Sent once, when fuzzing starts, to indicate the available coverage data.
package/std/Build.zig CHANGED
@@ -38,7 +38,6 @@ verbose_cc: bool,
38
38
  verbose_air: bool,
39
39
  verbose_llvm_ir: ?[]const u8,
40
40
  verbose_llvm_bc: ?[]const u8,
41
- verbose_cimport: bool,
42
41
  verbose_llvm_cpu_features: bool,
43
42
  reference_trace: ?u32 = null,
44
43
  invalid_user_input: bool,
@@ -86,10 +85,10 @@ libc_runtimes_dir: ?[]const u8 = null,
86
85
 
87
86
  dep_prefix: []const u8 = "",
88
87
 
89
- modules: std.StringArrayHashMap(*Module),
88
+ modules: std.array_hash_map.String(*Module),
90
89
 
91
- named_writefiles: std.StringArrayHashMap(*Step.WriteFile),
92
- named_lazy_paths: std.StringArrayHashMap(LazyPath),
90
+ named_writefiles: std.array_hash_map.String(*Step.WriteFile),
91
+ named_lazy_paths: std.array_hash_map.String(LazyPath),
93
92
  /// The hash of this instance's package. `""` means that this is the root package.
94
93
  pkg_hash: []const u8,
95
94
  /// A mapping from dependency names to package hashes.
@@ -128,6 +127,9 @@ pub const Graph = struct {
128
127
  random_seed: u32 = 0,
129
128
  dependency_cache: InitializedDepMap = .empty,
130
129
  allow_so_scripts: ?bool = null,
130
+ /// Steps should use `io` to limit the number of jobs, however in the case of
131
+ /// a single step spawning a fixed number of processes this can be used.
132
+ max_jobs: ?u32 = null,
131
133
  time_report: bool,
132
134
  /// Similar to the `Io.Terminal.Mode` returned by `Io.lockStderr`, but also
133
135
  /// respects the '--color' flag.
@@ -275,7 +277,6 @@ pub fn create(
275
277
  .verbose_air = false,
276
278
  .verbose_llvm_ir = null,
277
279
  .verbose_llvm_bc = null,
278
- .verbose_cimport = false,
279
280
  .verbose_llvm_cpu_features = false,
280
281
  .invalid_user_input = false,
281
282
  .allocator = arena,
@@ -309,9 +310,9 @@ pub fn create(
309
310
  },
310
311
  .install_path = undefined,
311
312
  .args = null,
312
- .modules = .init(arena),
313
- .named_writefiles = .init(arena),
314
- .named_lazy_paths = .init(arena),
313
+ .modules = .empty,
314
+ .named_writefiles = .empty,
315
+ .named_lazy_paths = .empty,
315
316
  .pkg_hash = "",
316
317
  .available_deps = available_deps,
317
318
  .release_mode = .off,
@@ -374,7 +375,6 @@ fn createChildOnly(
374
375
  .verbose_air = parent.verbose_air,
375
376
  .verbose_llvm_ir = parent.verbose_llvm_ir,
376
377
  .verbose_llvm_bc = parent.verbose_llvm_bc,
377
- .verbose_cimport = parent.verbose_cimport,
378
378
  .verbose_llvm_cpu_features = parent.verbose_llvm_cpu_features,
379
379
  .reference_trace = parent.reference_trace,
380
380
  .invalid_user_input = false,
@@ -402,9 +402,9 @@ fn createChildOnly(
402
402
  .enable_wine = parent.enable_wine,
403
403
  .libc_runtimes_dir = parent.libc_runtimes_dir,
404
404
  .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }),
405
- .modules = .init(allocator),
406
- .named_writefiles = .init(allocator),
407
- .named_lazy_paths = .init(allocator),
405
+ .modules = .empty,
406
+ .named_writefiles = .empty,
407
+ .named_lazy_paths = .empty,
408
408
  .pkg_hash = pkg_hash,
409
409
  .available_deps = pkg_deps,
410
410
  .release_mode = parent.release_mode,
@@ -905,7 +905,7 @@ pub const AssemblyOptions = struct {
905
905
  /// `createModule` can be used instead to create a private module.
906
906
  pub fn addModule(b: *Build, name: []const u8, options: Module.CreateOptions) *Module {
907
907
  const module = Module.create(b, options);
908
- b.modules.put(b.dupe(name), module) catch @panic("OOM");
908
+ b.modules.put(b.graph.arena, b.dupe(name), module) catch @panic("OOM");
909
909
  return module;
910
910
  }
911
911
 
@@ -1053,12 +1053,12 @@ pub fn addWriteFile(b: *Build, file_path: []const u8, data: []const u8) *Step.Wr
1053
1053
 
1054
1054
  pub fn addNamedWriteFiles(b: *Build, name: []const u8) *Step.WriteFile {
1055
1055
  const wf = Step.WriteFile.create(b);
1056
- b.named_writefiles.put(b.dupe(name), wf) catch @panic("OOM");
1056
+ b.named_writefiles.put(b.graph.arena, b.dupe(name), wf) catch @panic("OOM");
1057
1057
  return wf;
1058
1058
  }
1059
1059
 
1060
1060
  pub fn addNamedLazyPath(b: *Build, name: []const u8, lp: LazyPath) void {
1061
- b.named_lazy_paths.put(b.dupe(name), lp.dupe(b)) catch @panic("OOM");
1061
+ b.named_lazy_paths.put(b.graph.arena, b.dupe(name), lp.dupe(b)) catch @panic("OOM");
1062
1062
  }
1063
1063
 
1064
1064
  /// Creates a step for mutating files inside a temporary directory created lazily
@@ -1896,11 +1896,11 @@ pub fn runAllowFail(
1896
1896
  }
1897
1897
  return stdout;
1898
1898
  },
1899
- .signal => |sig| {
1899
+ .signal, .stopped => |sig| {
1900
1900
  out_code.* = @as(u8, @truncate(@intFromEnum(sig)));
1901
1901
  return error.ProcessTerminated;
1902
1902
  },
1903
- .stopped, .unknown => |code| {
1903
+ .unknown => |code| {
1904
1904
  out_code.* = @as(u8, @truncate(code));
1905
1905
  return error.ProcessTerminated;
1906
1906
  },
package/std/Io/Dir.zig CHANGED
@@ -1993,7 +1993,7 @@ pub fn setFileOwner(
1993
1993
  owner: ?File.Uid,
1994
1994
  group: ?File.Gid,
1995
1995
  options: SetFileOwnerOptions,
1996
- ) SetOwnerError!void {
1996
+ ) SetFileOwnerError!void {
1997
1997
  return io.vtable.dirSetFileOwner(io.userdata, dir, sub_path, owner, group, options);
1998
1998
  }
1999
1999
 
@@ -2032,9 +2032,14 @@ pub fn setTimestampsNow(
2032
2032
  sub_path: []const u8,
2033
2033
  options: SetTimestampsNowOptions,
2034
2034
  ) SetTimestampsError!void {
2035
- return io.vtable.fileSetTimestamps(io.userdata, dir, sub_path, .{
2035
+ return io.vtable.dirSetTimestamps(io.userdata, dir, sub_path, .{
2036
2036
  .follow_symlinks = options.follow_symlinks,
2037
2037
  .access_timestamp = .now,
2038
2038
  .modify_timestamp = .now,
2039
2039
  });
2040
2040
  }
2041
+
2042
+ test {
2043
+ _ = &setFileOwner;
2044
+ _ = &setTimestampsNow;
2045
+ }
@@ -459,7 +459,6 @@ pub fn io(ev: *Evented) Io {
459
459
  .netConnectUnix = netConnectUnixUnavailable,
460
460
  .netSocketCreatePair = netSocketCreatePairUnavailable,
461
461
  .netSend = netSendUnavailable,
462
- .netRead = netReadUnavailable,
463
462
  .netWrite = netWriteUnavailable,
464
463
  .netWriteFile = netWriteFileUnavailable,
465
464
  .netClose = netClose,
@@ -1713,6 +1712,7 @@ fn operate(userdata: ?*anyopaque, operation: Io.Operation) Io.Cancelable!Io.Oper
1713
1712
  },
1714
1713
  .device_io_control => |*o| return .{ .device_io_control = try deviceIoControl(o) },
1715
1714
  .net_receive => @panic("TODO implement net_receive operation"),
1715
+ .net_read => @panic("TODO implement net_read operation"),
1716
1716
  }
1717
1717
  }
1718
1718
 
@@ -2134,6 +2134,7 @@ fn batchDrainSubmitted(
2134
2134
  },
2135
2135
  .device_io_control => {},
2136
2136
  .net_receive => @panic("TODO implement batched net_receive"),
2137
+ .net_read => @panic("TODO implement batched net_read"),
2137
2138
  };
2138
2139
  if (concurrency) return error.ConcurrencyUnavailable;
2139
2140
  break :result try operate(ev, storage.submission.operation);
@@ -2193,6 +2194,7 @@ fn batchSourceEvent(context: ?*anyopaque) callconv(.c) void {
2193
2194
  },
2194
2195
  .device_io_control => unreachable,
2195
2196
  .net_receive => @panic("TODO implement batched net_receive"),
2197
+ .net_read => @panic("TODO implement batched net_read"),
2196
2198
  };
2197
2199
 
2198
2200
  switch (pending.node.prev) {
@@ -2512,6 +2514,7 @@ fn dirCreateFile(
2512
2514
  .OPNOTSUPP => return error.FileLocksUnsupported,
2513
2515
  .AGAIN => return error.WouldBlock,
2514
2516
  .TXTBSY => return error.FileBusy,
2517
+ .ROFS => return error.ReadOnlyFileSystem,
2515
2518
  .NXIO => return error.NoDevice,
2516
2519
  .ILSEQ => return error.BadPathName,
2517
2520
  else => |err| return unexpectedErrno(err),
@@ -2647,6 +2650,7 @@ fn dirOpenFile(
2647
2650
  .AGAIN => return error.WouldBlock,
2648
2651
  .TXTBSY => return error.FileBusy,
2649
2652
  .NXIO => return error.NoDevice,
2653
+ .ROFS => return error.ReadOnlyFileSystem,
2650
2654
  .ILSEQ => return error.BadPathName,
2651
2655
  else => |err| return unexpectedErrno(err),
2652
2656
  }
@@ -4875,18 +4879,6 @@ fn netSendUnavailable(
4875
4879
  return .{ error.NetworkDown, 0 };
4876
4880
  }
4877
4881
 
4878
- fn netReadUnavailable(
4879
- userdata: ?*anyopaque,
4880
- fd: net.Socket.Handle,
4881
- data: [][]u8,
4882
- ) net.Stream.Reader.Error!usize {
4883
- const ev: *Evented = @ptrCast(@alignCast(userdata));
4884
- _ = ev;
4885
- _ = fd;
4886
- _ = data;
4887
- return error.NetworkDown;
4888
- }
4889
-
4890
4882
  fn netWriteUnavailable(
4891
4883
  userdata: ?*anyopaque,
4892
4884
  handle: net.Socket.Handle,
@@ -309,7 +309,9 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize {
309
309
  return 0;
310
310
  };
311
311
  const logical_pos = logicalPos(r);
312
- const delta = @min(@intFromEnum(limit), size - logical_pos);
312
+ const bytes_remaining = size - logical_pos;
313
+ if (bytes_remaining == 0) return error.EndOfStream;
314
+ const delta = @min(@intFromEnum(limit), bytes_remaining);
313
315
  setLogicalPos(r, logical_pos + delta);
314
316
  return delta;
315
317
  },
@@ -162,9 +162,10 @@ fn sendFilePositional(w: *Writer, file_reader: *Io.File.Reader, limit: Io.Limit)
162
162
  w.err = error.Canceled;
163
163
  return error.WriteFailed;
164
164
  },
165
- error.EndOfStream => return error.EndOfStream,
166
- error.Unimplemented => return error.Unimplemented,
167
- error.ReadFailed => return error.ReadFailed,
165
+ error.EndOfStream,
166
+ error.Unimplemented,
167
+ error.ReadFailed,
168
+ => |e| return e,
168
169
  else => |e| {
169
170
  w.write_file_err = e;
170
171
  return error.WriteFailed;
@@ -182,9 +183,10 @@ fn sendFileStreaming(w: *Writer, file_reader: *Io.File.Reader, limit: Io.Limit)
182
183
  w.err = error.Canceled;
183
184
  return error.WriteFailed;
184
185
  },
185
- error.EndOfStream => return error.EndOfStream,
186
- error.Unimplemented => return error.Unimplemented,
187
- error.ReadFailed => return error.ReadFailed,
186
+ error.EndOfStream,
187
+ error.Unimplemented,
188
+ error.ReadFailed,
189
+ => |e| return e,
188
190
  else => |e| {
189
191
  w.write_file_err = e;
190
192
  return error.WriteFailed;
package/std/Io/File.zig CHANGED
@@ -202,6 +202,7 @@ pub const OpenError = error{
202
202
  NotDir,
203
203
  /// The path already exists and the `CREAT` and `EXCL` flags were provided.
204
204
  PathAlreadyExists,
205
+ ReadOnlyFileSystem,
205
206
  DeviceBusy,
206
207
  FileLocksUnsupported,
207
208
  /// One of these three things:
package/std/Io/Kqueue.zig CHANGED
@@ -186,7 +186,7 @@ pub fn init(k: *Kqueue, gpa: Allocator, options: InitOptions) !void {
186
186
  .awaiter = null,
187
187
  .queue_next = null,
188
188
  .cancel_thread = null,
189
- .awaiting_completions = .initEmpty(),
189
+ .awaiting_completions = .empty,
190
190
  };
191
191
  const main_thread = &k.threads.allocated[0];
192
192
  Thread.self = main_thread;
@@ -713,7 +713,7 @@ fn concurrent(
713
713
  .awaiter = null,
714
714
  .queue_next = null,
715
715
  .cancel_thread = null,
716
- .awaiting_completions = .initEmpty(),
716
+ .awaiting_completions = .empty,
717
717
  };
718
718
  closure.* = .{
719
719
  .kqueue = k,
package/std/Io/Reader.zig CHANGED
@@ -200,8 +200,7 @@ pub fn defaultDiscard(r: *Reader, limit: Limit) Error!usize {
200
200
  var d: Writer.Discarding = .init(r.buffer);
201
201
  var n = r.stream(&d.writer, limit) catch |err| switch (err) {
202
202
  error.WriteFailed => unreachable,
203
- error.ReadFailed => return error.ReadFailed,
204
- error.EndOfStream => return error.EndOfStream,
203
+ error.ReadFailed, error.EndOfStream => |e| return e,
205
204
  };
206
205
  // If `stream` wrote to `r.buffer` without going through the writer,
207
206
  // we need to discard as much of the buffered data as possible.
@@ -379,7 +378,7 @@ pub fn appendRemainingAligned(
379
378
  const n = stream(r, &a.writer, remaining) catch |err| switch (err) {
380
379
  error.EndOfStream => return,
381
380
  error.WriteFailed => return error.OutOfMemory,
382
- error.ReadFailed => return error.ReadFailed,
381
+ error.ReadFailed => |e| return e,
383
382
  };
384
383
  remaining = remaining.subtract(n).?;
385
384
  }
@@ -400,7 +399,7 @@ pub fn appendRemainingUnlimited(r: *Reader, gpa: Allocator, list: *ArrayList(u8)
400
399
  }
401
400
  _ = streamRemaining(r, &a.writer) catch |err| switch (err) {
402
401
  error.WriteFailed => return error.OutOfMemory,
403
- error.ReadFailed => return error.ReadFailed,
402
+ error.ReadFailed => |e| return e,
404
403
  };
405
404
  }
406
405
 
@@ -428,7 +427,7 @@ pub fn readVec(r: *Reader, data: [][]u8) Error!usize {
428
427
  defer data[i] = buf;
429
428
  return n + (r.vtable.readVec(r, data[i..]) catch |err| switch (err) {
430
429
  error.EndOfStream => if (n == 0) return error.EndOfStream else 0,
431
- error.ReadFailed => return error.ReadFailed,
430
+ error.ReadFailed => |e| return e,
432
431
  });
433
432
  }
434
433
  const n = seek - r.seek;
@@ -639,7 +638,7 @@ pub fn discardShort(r: *Reader, n: usize) ShortError!usize {
639
638
  while (true) {
640
639
  const discard_len = r.vtable.discard(r, .limited(remaining)) catch |err| switch (err) {
641
640
  error.EndOfStream => return n - remaining,
642
- error.ReadFailed => return error.ReadFailed,
641
+ error.ReadFailed => |e| return e,
643
642
  };
644
643
  remaining -= discard_len;
645
644
  if (remaining == 0) return n;
@@ -687,7 +686,7 @@ pub fn readSliceShort(r: *Reader, buffer: []u8) ShortError!usize {
687
686
  data[0] = buffer[i..];
688
687
  i += readVec(r, &data) catch |err| switch (err) {
689
688
  error.EndOfStream => return i,
690
- error.ReadFailed => return error.ReadFailed,
689
+ error.ReadFailed => |e| return e,
691
690
  };
692
691
  if (buffer.len - i == 0) return buffer.len;
693
692
  }
@@ -1009,7 +1008,7 @@ pub fn streamDelimiterLimit(
1009
1008
  var remaining = @intFromEnum(limit);
1010
1009
  while (remaining != 0) {
1011
1010
  const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) {
1012
- error.ReadFailed => return error.ReadFailed,
1011
+ error.ReadFailed => |e| return e,
1013
1012
  error.EndOfStream => return @intFromEnum(limit) - remaining,
1014
1013
  });
1015
1014
  if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| {
@@ -1080,7 +1079,7 @@ pub fn discardDelimiterLimit(r: *Reader, delimiter: u8, limit: Limit) DiscardDel
1080
1079
  var remaining = @intFromEnum(limit);
1081
1080
  while (remaining != 0) {
1082
1081
  const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) {
1083
- error.ReadFailed => return error.ReadFailed,
1082
+ error.ReadFailed => |e| return e,
1084
1083
  error.EndOfStream => return @intFromEnum(limit) - remaining,
1085
1084
  });
1086
1085
  if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| {