Commit graph

34584 commits

Author SHA1 Message Date
Nathaniel Ketema
5c0ad01d3c fix: fix typo in comment by removing repeated 'business' word 2025-08-24 23:00:17 +02:00
Becker A.
718ee31e21 Update powi.zig to fix docstring formatting
Without this change, the docs are formatted s.t. the text "Edge case rules ordered by precedence:" is appended onto the prior line of text "Underflow: Absolute value of result smaller than 1", instead of getting its own line.
2025-08-24 22:59:08 +02:00
Andrew Kelley
83f773fc64
Merge pull request #24960 from ziglang/MemoryAccessor
std.debug: delete MemoryAccessor
2025-08-23 18:54:32 -07:00
Andrew Kelley
e4a7b15852 disable stack tracing on powerpc64
tracked by #24970
2025-08-23 13:48:52 -07:00
Andrew Kelley
d00cc10086 std.debug: delete MemoryAccessor
This API is based around the unsound idea that a process can perform
checked virtual memory loads to prevent crashing. This depends on
OS-specific APIs that may be unavailable, disabled, or impossible due to
virtualization.

It also makes collecting stack traces ridiculously slow, which is a
problem for users of DebugAllocator - in other words, everybody, all the
time. It also makes strace go from being superbly clean to being awful.
2025-08-23 13:48:52 -07:00
Alex Rønne Petersen
77c09d16f9 std.fs.Dir: fix updateFile() to flush the file before updating its times
AtomicFile.finish() calls flush() which renders any previous updateTimes() calls
useless. Regression introduced in f2a3ac7c05.

Closes #24927.
2025-08-23 12:32:14 -07:00
John Benediktsson
47a2f2ddae
Merge pull request #24926 from mrjbq7/http-fetch
http.Client: don't forget to flush
2025-08-22 12:35:18 -07:00
GasInfinity
306176046e chore(std.Target): explicitly set baseline only to arm with 3ds
* `arm` is the only supported tag for 3ds

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-22 04:14:53 +02:00
GasInfinity
fca2a7a638 test(llvm_targets): remove unused thumb-3ds 2025-08-22 04:14:53 +02:00
GasInfinity
851f31b0e1 chore(std.Target): document the 3ds version range 2025-08-22 04:14:53 +02:00
GasInfinity
cc71936eb9 feat(std.Target): add 3ds os 2025-08-22 04:14:53 +02:00
Raiden1411
55daefdb10 std: remove lossy int to float coercion on json parse 2025-08-22 02:50:26 +02:00
Andrew Kelley
ba726ab65a langref: update nav link 2025-08-21 14:02:12 -07:00
Andrew Kelley
595c9d2353
Merge pull request #24921 from Justus2308/messy-mach
std.c.darwin: cleanup, expose everything in std.c
2025-08-21 11:52:22 -07:00
Justus Klausecker
1594c80555 zig reduce: adapt to new Writer API 2025-08-21 11:50:03 -07:00
Isaac Freund
52de06c3b0 langref: sync with zig-spec grammar.peg 2025-08-21 17:12:38 +02:00
Sardorbek Imomaliev
01b5023868
drop NameTooLong from sysctlbynameZ error set (#24909) 2025-08-21 12:36:57 +02:00
Justus Klausecker
da4c9af354 make some compile errors aliases instead 2025-08-21 11:33:34 +02:00
Lwazi Dube
cab6d752e8 std.os.uefi: Fix typo that causes compile time error #22809" 2025-08-21 03:10:28 +01:00
Brandon Black
8248597a27 Add mlock syscalls to std.c and std.posix
Linux already gained the relevant syscalls and consts in #24473

The basic mlock() and munlock() are fairly universal across the
*nix world with a consistent interface, but are missing on wasi
and windows.

The mlockall() and munlockall() calls are not as widely supported
as the basic ones.  Notable non-implementers include darwin,
haiku, and serenity (and of course wasi and windows again).

mlock2() is Linux-only, as are its MLOCK flags.
2025-08-20 23:38:45 +02:00
Carl Åstholm
172e97154d Use readStreaming, not readPositional, for streaming file readVec on Windows 2025-08-20 21:49:07 +02:00
Alex Rønne Petersen
07cc32b004 wasi-libc: update to c89896107d7b57aef69dcadede47409ee4f702ee 2025-08-20 19:18:11 +02:00
Justus Klausecker
590d264bdf std.c.darwin: cleanup, expose everything in std.c
This mainly just moves stuff around.
Justifications for other changes:
* `KEVENT.FLAGS` is backed by `c_uint` because that's what the `kevent64` flags param takes (according to the 'latest' manpage from 2008)
* `MACH_RCV_NOTIFY` is a legacy name and `MACH_RCV_OVERWRITE` is deprecated (xnu/osfmk/mach/message.h), so I removed them. They were 0 anyway and thus couldn't be represented
as a packed struct field.
* `MACH.RCV` and `MACH.SEND` are technically the same 'type' because they can both be supplied at the same time to `mach_msg`. I decided to still keep them separate because
naming works out better that way and all flags except for `MACH_MSG_STRICT_REPLY` aren't shared anyway. Both are part of a packed union `mach_msg_option_t` which supplies a
helper function to combine the two types.
* `PT` is backed by `c_int` because that's what `ptrace` takes as a request arg (according to the latest manpage from 2015)
2025-08-20 18:21:32 +02:00
Justus Klausecker
d748cc9c12 expose darwin.PT in std.c 2025-08-19 16:18:27 -07:00
Carl Åstholm
9e9cb3ad6d Fix bugs in Windows readVec implementations 2025-08-19 16:18:02 -07:00
TemariVirus
51a2c0feaf std.Io.Writer: fix upper case hex float formatting 2025-08-19 11:20:30 -07:00
Rohlem
81f5a7b8fd
never advance seek position in std.Io.Reader.peekDelimiterExclusive (#24899)
* extend std.Io.Reader.peekDelimiterExclusive test to repeat successful end-of-stream path (fails)

* fix std.Io.Reader.peekDelimiterExclusive to not advance seek position in successful end-of-stream path
2025-08-19 11:19:02 -07:00
Andrew Kelley
07e7cfa35b update .mailmap
keeps our contributor count in the release notes somewhat accurate
2025-08-18 21:56:23 -07:00
Andrew Kelley
cf5f8113c1 start the 0.16.0 release cycle 2025-08-18 21:33:09 -07:00
Andrew Kelley
94cda37d69 Release 0.15.0 2025-08-18 21:32:35 -07:00
Andrew Kelley
89c9282d34 std.http.Client: discard response body when reusing connection
When an error response was encountered, such as 404 not found, the body
wasn't discarded, leading to the string "404 not found" being
incorrectly interpreted as the next request's response.

closes #24732
2025-08-18 17:26:55 -07:00
Giuseppe Cesarano
b734d03340
Expanded std.os.linux perf-related definitions (#24264)
* Added perf_event_header definition

* Added perf_event_mmap_page definition

* Removed default values for perf_event_header

* Fixed comments typos

* Updated perf_event_attr definition

* Explicit packet struct type

* PERF.RECORD from struct to enum

* fix typo: miscs to misc

* misc as packed struct

* cpu_mode as named enum

* Rescoping CPU_MODE
2025-08-18 21:32:44 +00:00
Andrew Kelley
001ec07772
Merge pull request #24249 from antlilja/dwarf-extern-arg
Fix compiler crash when passing a comptime extern function arg to a function
2025-08-18 13:25:13 -07:00
mlugg
c1483eb05c Compilation: fix compiler_rt and ubsan_rt strategy logic
It doesn't really make sense for `target_util.canBuildLibCompilerRt`
(and its ubsan-rt friend) to take in `use_llvm`, because the caller
doesn't control that: they're just going to queue a sub-compilation for
the runtime. The only exception to that is the ZCU strategy, where we
effectively embed `_ = @import("compiler_rt")` into the Zig compilation:
there, the question does matter. Rather than trying to do multiple weird
calls to model this, just have `canBuildLibCompilerRt` return not just a
boolean, but also differentiate the self-hosted backend being capable of
building the library vs only LLVM being capable. Logic in `Compilation`
uses that difference to decide whether to use the ZCU strategy, and also
to disable the library if the compiler does not support LLVM and it is
required.

Also, remove a redundant check later on, when actually queuing jobs.
We've already checked that we can build `compiler_rt`, and
`compiler_rt_strat` is set accordingly. I'm guessing this was there to
work around a bug I saw in the old strategy assignment, where support
was ignored in some cases.

Resolves: #24623
2025-08-18 13:07:40 -07:00
Ali Cheraghi
2f422372b5 spirv: do not decorate nav alignment
they seem to be always `null` even when accessed through extern key so we have no way to tell whether they have natural alignment or not to decorate. And the reason we don't always decorate them is because some environments might be too dumb and crash for this.
2025-08-18 11:24:57 -07:00
Justus Klausecker
cf90a5e451 langref: add documentation for unions with inferred tag and explicit tag values 2025-08-17 19:17:02 -07:00
Isaac Freund
c315f2bc2e http.BodyWriter: improve clarity of chunked state machine
This is theoretically a bugfix as well, since it enforces the correct
limit on the first write after writing the header. This theoretical bug
hasn't been hit in practice though as far as I know.
2025-08-17 14:42:57 +02:00
Andrew Kelley
623290ea9b
Merge pull request #24864 from ifreund/fix-std-cmd
http.BodyWriter: handle EOF in chunkedSendFile, simplify
2025-08-16 16:24:11 -07:00
Isaac Freund
551e009da7 Build.Step.Run: fix missing stdin buffer and flush
Writer.sendFileAll() asserts non-zero buffer capacity in the case that
the fallback is hit. It also requires the caller to flush. The buffer
may be bypassed as an optimization but this is not a guarantee.

Also improve the Writer documentation and add an earlier assert on
buffer capacity in sendFileAll().
2025-08-16 15:43:48 -07:00
Andrew Kelley
399bace2f2
Merge pull request #24874 from ziglang/tls-client
std: more reliable HTTP and TLS networking
2025-08-16 14:47:52 -07:00
Andrew Kelley
ef14c73245 Compilation: remove last instance of deprecatedReader
This also makes initStreaming preemptively disable file size checking.
2025-08-16 14:46:20 -07:00
mlugg
0096c0806c Compilation: retain ZCU object when emitting unstripped Mach-O binary
On macOS, when using the LLVM backend, the output binary retains a
reference to this object file's debug info (as opposed to self-hosted
backends which instead emit a dSYM bundle). As such, we need to retain
this object file in such cases. This object does unfortunately "leak",
in that it won't be reused and will just sit in the cache forever (or
until GC'd in the future). But that's no worse than the cache behavior
prior to the rework that caused this, and it will become less of a
problem over time as the self-hosted backend gains usability for debug
builds and eventually becomes the default.

Resolves: #24369
2025-08-16 21:56:24 +01:00
Isaac Freund
0cfd07bc86
http.BodyWriter: handle EOF in chunkedSendFile, simplify
With these changes, the `zig std` command now works again and doesn't
trigger assertion failures or mess up the chunked transfer encoding.
2025-08-16 22:07:16 +02:00
Isaac Freund
ce4e8a991f
std-docs: improve error message on write failure 2025-08-16 17:43:15 +02:00
Josh Wolfe
4fcdb08390 [std] fix compile error in std.Io.Writer.failing 2025-08-16 00:23:47 -07:00
Özgür Akkurt
99c4890559
implement registering NAPI on IoUring (#24850) 2025-08-16 09:18:49 +02:00
Andrew Kelley
a0f9a5e78d std: more reliable HTTP and TLS networking
* std.Io.Reader: fix confused semantics of rebase. Before it was
  ambiguous whether it was supposed to be based on end or seek. Now it
  is clearly based on seek, with an added assertion for clarity.

* std.crypto.tls.Client: fix panic due to not enough buffer size
  available. Also, avoid unnecessary rebasing.

* std.http.Reader: introduce max_head_len to limit HTTP header length.
  This prevents crash in underlying reader which may require a minimum
  buffer length.

* std.http.Client: choose better buffer sizes for streams and TLS
  client. Crucially, the buffer shared by HTTP reader and TLS client
  needs to be big enough for all http headers *and* the max TLS record
  size. Bump HTTP header size default from 4K to 8K.

fixes #24872

I have noticed however that there are still fetch problems
2025-08-16 00:16:15 -07:00
Andrew Kelley
07b753f22b Fetch: bump zstd decompression buffer
see #24735
2025-08-16 00:07:40 -07:00
Ryan Liptak
98547713a3 zstd: Protect against index out-of-bounds when decoding sequences
Previously, index out-of-bounds could occur when copying match_length bytes while decoding whatever sequence happened to overflow `dest`. Now, each sequence checks that there is enough room for the full sequence_length (literal_length + match_length) before doing any copying.

Fixes the failing inputs found here: https://github.com/ziglang/zig/issues/24817#issuecomment-3192927715
2025-08-15 22:11:51 -07:00
Rue
ee85c8b6d0
re-enable std.math.modf vector tests (#24786)
* re-enable std.math.modf vector tests
* re-disable std.math.modf vector tests for `aarch64-macos`
* re-disable for s390x architecture
2025-08-16 02:36:09 +00:00