10428 Commits

Author SHA1 Message Date
mlugg
107b65ec5d Sema: explain why we tried to call an extern fn at comptime
I recently saw a user hit the "comptime call of extern function" error,
and get confused because they didn't know why the scope was `comptime`.
So, use `explainWhyBlockIsComptime` on this and related errors to add
all the relevant notes.

The added test case shows the motivating situation.
2025-01-29 18:43:24 +00:00
Alex Rønne Petersen
484f72311e
Merge pull request #22634 from nektro/patch-6
std.c: was missing more
2025-01-29 16:26:57 +01:00
Meghan Denny
0bf57b7114 std: mkdir(2) mode uses mode_t 2025-01-29 14:57:07 +01:00
David Rubin
898658e3a0 std.c: add msghdr and msghdr_const definitions for macos 2025-01-29 13:34:37 +01:00
Alex Rønne Petersen
7843deb16b std.zig.system.darwin: Add driverkit handling in getSdk(). 2025-01-29 09:25:06 +01:00
ThisPC
e528ab4709 std.testing.expectEqual: {any} in print and move tests 2025-01-29 09:19:07 +01:00
thejohnny5
78b7a446f0 std: add optional times pointer for futimes, futimens, utimes, utimensat 2025-01-29 09:17:20 +01:00
Meghan Denny
97ccf3504f std.c: was missing darwin.kevent64_s 2025-01-29 06:34:34 +01:00
Meghan Denny
0bbea1e848
std.c: was missing darwin.@"close$NOCANCEL" 2025-01-27 22:26:20 -08:00
Meghan Denny
1bfadc1381
std.c: was missing darwin.host_t 2025-01-27 21:40:23 -08:00
Meghan Denny
87b0e0821a
std.c: was missing darwin.natural_t 2025-01-27 21:38:25 -08:00
Alex Rønne Petersen
41e7604359
Merge pull request #22573 from sorairolake/fix-invisible-doccomments
Fix invisible doccomments at the start of source files to make them visible
2025-01-28 04:59:14 +01:00
John Benediktsson
884b1423a4 std.heap.memory_pool: make preheat() usable after init() 2025-01-28 00:06:54 +01:00
Andrew Kelley
df1fa36feb Revert "std.http.Server: add Request.getHeader() function (#21625)"
This reverts commit 21823d1b5d1ebfa27df954c2cef5d0f231fb8402.

It's a bad API that could easily lead to O(N^2) logic.
2025-01-27 11:13:56 -08:00
dbubel
21823d1b5d
std.http.Server: add Request.getHeader() function (#21625) 2025-01-27 17:58:05 +00:00
Carter Snook
2043e8ae05
main: classify empty environment variables as unset
This matches existing well-specified conventions for e.g. NO_COLOR.

Closes #22380.
2025-01-27 17:53:32 +01:00
Alex Rønne Petersen
5647dd84c1 Revert d714cf33405486d9aa707e9aee8f103a011d06e9 (#21273)
Turns out this was already fixed in #21964.

I have no idea why GitHub showed an incorrect diff in #21273, or how applying the diff to master was even possible, but here we are.
2025-01-26 20:52:29 -08:00
Shun Sakai
7599216341
std.zip: Include the last paragraph in top-level doc comments
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-01-27 12:24:36 +09:00
injuly
d714cf3340
std.c.darwin: Fix EXC.MASK compile error (#21273) 2025-01-26 19:56:14 +01:00
Fri3dNstuff
9c6d728b0c
std.meta: handle comptime fields in hasUniqueRepresentation (#22132) 2025-01-26 18:23:34 +00:00
Eric Joldasov
3179961854 std.Build: add more explicit error sets to some functions
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
2025-01-26 19:03:33 +01:00
thejohnny5
5b3eaff80d std: check max depth for vector type in formatType 2025-01-26 18:53:11 +01:00
Enrique Miguel Mora Meza
24965af295
std.os.linux: Adding sigdelset (#22406) 2025-01-26 18:49:25 +01:00
Pierre Tachoire
df9fdb1861 std.net.listen: no REUSEPORT with unix socket
On Linux, set REUSEPORT option on an unix socket returns a EOPNOTSUPP error.
See 5b0af621c3
2025-01-26 18:40:34 +01:00
Meghan Denny
92b20e4216 stf: do not call xcode-select or xcrun by absolute path in darwin sdk detection 2025-01-26 09:07:39 +01:00
ziggoon
6a4986b2d6 Update LDR_DATA_TABLE_ENTRY struct 2025-01-26 03:40:17 +01:00
Matthew Lugg
3767b08039
Merge pull request #22602 from mlugg/incr-embedfile
incremental: handle `@embedFile`
2025-01-26 01:41:56 +00:00
Alex Rønne Petersen
015a5e1982 std.Build: Make ofmt part of standardTargetOptions(). 2025-01-25 20:39:10 +01:00
Andrew Kelley
d0d5ca2b6c
Merge pull request #22581 from jacobly0/x86_64-rewrite
x86_64: rewrite `@abs` on floats
2025-01-25 07:30:45 -08:00
mlugg
5202c977d9
std: add fs.path.fmtJoin
This allows joining paths without allocating using a `Writer`.
2025-01-25 04:48:00 +00:00
Jacob Young
c7433212d1 x86_64: rewrite scalar and vector int @min and @max 2025-01-24 21:02:32 -05:00
Jacob Young
b1fa89439a x86_64: rewrite float vector @abs and equality comparisons 2025-01-24 20:56:11 -05:00
mlugg
3232e59ab9
std: remove old declarations now a zig1 update has happened 2025-01-24 22:33:23 +00:00
mlugg
5a6666db55
all: update for panic.unwrapError and panic.call signature changes 2025-01-24 22:33:23 +00:00
mlugg
83991efe10
compiler: yet more panic handler changes
* `std.builtin.Panic` -> `std.builtin.panic`, because it is a namespace.
* `root.Panic` -> `root.panic` for the same reason. There are type
  checks so that we still allow the legacy `pub fn panic` strategy in
  the 0.14.0 release.
* `std.debug.SimplePanic` -> `std.debug.simple_panic`, same reason.
* `std.debug.NoPanic` -> `std.debug.no_panic`, same reason.
* `std.debug.FormattedPanic` is now a function `std.debug.FullPanic`
  which takes as input a `panicFn` and returns a namespace with all the
  panic functions. This handles the incredibly common case of just
  wanting to override how the message is printed, whilst keeping nice
  formatted panics.
* Remove `std.builtin.panic.messages`; now, every safety panic has its
  own function. This reduces binary bloat, as calls to these functions
  no longer need to prepare any arguments (aside from the error return
  trace).
* Remove some legacy declarations, since a zig1.wasm update has
  happened. Most of these were related to the panic handler, but a quick
  grep for "zig1" brought up a couple more results too.

Also, add some missing type checks to Sema.

Resolves: #22584

formatted -> full
2025-01-24 19:29:51 +00:00
Alex Rønne Petersen
180db2bf23
std.debug: Fall back to .eh_frame/.debug_frame if .eh_frame_hdr is incomplete.
When using the self-hosted backends, especially in incremental mode, the
.eh_frame_hdr section may be incomplete, so we can't treat it as authoritative.

Instead, if we started out intending to use .eh_frame_hdr but find that it's
incomplete, load .eh_frame/.debug_frame on demand and use that info going
forward.
2025-01-23 23:22:38 +00:00
Alex Rønne Petersen
d916954bee
Merge pull request #22098 from alexrp/wasm-generic-baseline
`std.Target`: Use `lime1` as wasm baseline model and `mvp` as generic model
2025-01-23 18:41:11 +01:00
Pierre Tachoire
f3c29dcb24 std.posix.setsockopt: EOPNOTSUPP can be returned
On Linux, set REUSEPORT option on an unix socket returns a EOPNOTSUPP
error.
See 5b0af621c3
2025-01-23 14:35:57 +01:00
John Benediktsson
530335b572
adding std.c.TCP.NODELAY for macos (#22404)
closes #17260
2025-01-23 04:01:05 +00:00
Alex Rønne Petersen
ea1502974d
wasm: Add a nontrapping_bulk_memory_len0 feature.
This will mainly be used when targeting our wasm2c implementation which has no
problem with zero-length bulk memory operations, as a non-standard extension.
2025-01-22 20:56:28 +01:00
Matthew Lugg
0e815c652d
Merge pull request #22572 from jacobly0/new-error-trace
compiler: include error trace in all functions, implement for x86_64 backend
2025-01-22 16:48:27 +00:00
Matthew Lugg
61fe307d0f
Merge pull request #22571 from mlugg/various-fixes-again
compiler: a few fixes
2025-01-22 16:47:45 +00:00
Shun Sakai
30fc1012ae std.zip: Replace invisible doc comments with top-level doc comments
I think it would be better if this invisible doc comments is top-level
doc comments rather than doc comments. Because it is at the start of a
source file. This makes the doc comments visible.

However, the last paragraph replaces doc comments with normal comments.
This is because I thought that normal comments would be more
appropriate than top-level doc comments given the context of the last
paragraph.
2025-01-22 23:37:04 +09:00
Shun Sakai
a3ad0a2f77 std.compress.flate.Lookup: Replace invisible doc comments with top-level doc comments
I think it would be better if this invisible doc comments is top-level
doc comments rather than doc comments. Because it is at the start of a
source file. This makes the doc comments visible.
2025-01-22 23:34:57 +09:00
mlugg
9b7b240c8e std.builtin: make returnError not take the error trace
It's now unnecessary to explicitly pass this, because it receives an
implicit error trace parameter anyway, so can just use
`@errorReturnTrace()`. The previous commit updated Sema to expect this
new interface. This saves an AIR instruction at all `returnError` call
sites.
2025-01-22 02:22:56 -05:00
mlugg
e864c38cc3
Sema: fix crash when inline loop condition is not comptime-known 2025-01-22 04:18:43 +00:00
BratishkaErik
941677e083
std.Build: add addLibrary function (#22554)
Acts as a replacement for `addSharedLibrary` and `addStaticLibrary`, but
linking mode can be changed more easily in build.zig, for example:

In library:
```zig
const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode for a foo_bar library") orelse .static; // or other default

const lib = b.addLibrary(.{
    .linkage = linkage,
    .name = "foo_bar",
    .root_module = mod,
});
```

In consumer:
```zig
const dep_foo_bar = b.dependency("foo_bar", .{
    .target = target,
    .optimize = optimize,
    .linkage = .static // or dynamic
});

mod.linkLibrary(dep_foor_bar.artifact("foo_bar"));
```

It also matches nicely with `linkLibrary` name.

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
2025-01-22 02:29:21 +00:00
mlugg
6e7ae66871
std.debug: remove errorReturnTraceHelper
This function doesn't do what it says; it's a nop.
2025-01-22 02:02:33 +00:00
Alex Rønne Petersen
280ced66eb
std.Target: Define and use lime1 as the baseline CPU model for WebAssembly.
See: https://github.com/WebAssembly/tool-conventions/pull/235

This is not *quite* using the same features as the spec'd lime1 model because
LLVM 19 doesn't have the level of feature granularity that we need for that.
This will be fixed once we upgrade to LLVM 20.

Part of #21818.
2025-01-22 03:01:05 +01:00
Alex Rønne Petersen
206373ca61
std.Target: Use mvp as the generic CPU model for wasm32/wasm64.
As discussed in #21818, generic is a poor baseline model because that model is a
moving target in LLVM. Instead, use mvp, which has no features enabled.
2025-01-22 03:01:05 +01:00