Commit graph

957 commits

Author SHA1 Message Date
Andrew Kelley
ba726ab65a langref: update nav link 2025-08-21 14:02:12 -07:00
Isaac Freund
52de06c3b0 langref: sync with zig-spec grammar.peg 2025-08-21 17:12:38 +02:00
Andrew Kelley
94cda37d69 Release 0.15.0 2025-08-18 21:32:35 -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
Justus Klausecker
d0586da18e Sema: Improve comptime arithmetic undef handling
This commit expands on the foundations laid by https://github.com/ziglang/zig/pull/23177
and moves even more `Sema`-only functionality from `Value`
to `Sema.arith`. Specifically all shift and bitwise operations,
`@truncate`, `@bitReverse` and `@byteSwap` have been moved and
adapted to the new rules around `undefined`.

Especially the comptime shift operations have been basically
rewritten, fixing many open issues in the process.

New rules applied to operators:
* `<<`, `@shlExact`, `@shlWithOverflow`, `>>`, `@shrExact`: compile error if any operand is undef
* `<<|`, `~`, `^`, `@truncate`, `@bitReverse`, `@byteSwap`: return undef if any operand is undef
* `&`, `|`: Return undef if both operands are undef, turn undef into actual `0xAA` bytes otherwise

Additionally this commit canonicalizes the representation of
aggregates with all-undefined members in the `InternPool` by
disallowing them and enforcing the usage of a single typed
`undef` value instead. This reduces the amount of edge cases
and fixes a bunch of bugs related to partially undefined vecs.

List of operations directly affected by this patch:
* `<<`, `<<|`, `@shlExact`, `@shlWithOverflow`
* `>>`, `@shrExact`
* `&`, `|`, `~`, `^` and their atomic rmw + reduce pendants
* `@truncate`, `@bitReverse`, `@byteSwap`
2025-08-12 16:33:57 +02:00
Andrew Kelley
749f10af49 std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
mlugg
bce6a7c215 langref: improve @import documentation
Rewrite to be more clear and correct. Also, explain ZON imports.

Resolves: #23314
2025-07-31 10:39:22 +01:00
Matthew Lugg
032bbd68a7
Merge pull request #24537 from IOKG04/some-documentation-updates-0
some small langref changes
2025-07-31 02:32:32 +01:00
Kendall Condon
cbe6e5b7fe langref: clarify allowed atomic types
Floats are not allowed in @cmpxchg

Packed structs are allowed for all atomic builtins
2025-07-30 09:56:38 +01:00
IOKG04
2dea904d5a .strong, not .Strong
https://github.com/ziglang/zig/pull/24537#issuecomment-3124556900
2025-07-28 15:15:49 +02:00
IOKG04
84ae54fbe6 @rem() and @mod() take denominator != 0, not just denominator > 0
https://github.com/ziglang/zig/issues/23635

I also added tests for `@rem()` with `denominator < 0` cause there were none before
I hope I added them in the correct place, if not I can change it ofc
2025-07-22 13:35:55 +02:00
IOKG04
a91b4aab73 error return traces are *not* enabled for ReleaseSafe
https://github.com/ziglang/zig/issues/24232
2025-07-22 12:35:46 +02:00
Kendall Condon
f657767b60 langref: upgrade grammar.y for asm clobber change 2025-07-20 19:37:41 +02:00
Andrew Kelley
d8e26275f2 update standalone and incremental tests to new API 2025-07-07 22:43:53 -07:00
Andrew Kelley
34f64432b0 remove usingnamespace from the language
closes #20663
2025-07-07 13:39:48 -07:00
Andrew Kelley
40d11cc25a remove async and await keywords
Also remove `@frameSize`, closing #3654.

While the other machinery might remain depending on #23446, it is
settled that there will not be `async`/ `await` keywords in the
language.
2025-07-07 13:39:16 -07:00
Daniel Kongsgaard
5e3c0b7af7
Allow more operators on bool vectors (#24131)
* Sema: allow binary operations and boolean not on vectors of bool

* langref: Clarify use of operators on vectors (`and` and `or` not allowed)

closes #24093
2025-06-12 15:16:23 -07:00
Alex Kladov
173bc42744
langref: undefined _is_ materialized in all safe modes (#24107)
* trailing whitespace

* langref: undefined _is_ materialized in all safe modes

I am also not super happy about the clause that immediately follows. I
_believe_ what we want to say here is that, simultaneously:

* undefined is guaranteed to be matrerialized in in all safe modes.
  A Zig implementation that elides `ptr.* = undefined` in ReleaseSafe
  mode would be a non-conforming implementation.
* A Zig program that relies on undefined being materialized is buggy.

But I don't think it's the time to engage this level of language-lawering!
2025-06-07 10:07:53 -07:00
Andrew Kelley
4315a57233 langref: update nav link for 0.14.1 2025-05-23 14:43:47 -07:00
dweiller
5cba7c8562 langref: document @memmove 2025-04-26 13:34:17 +10:00
Andrew Kelley
bd38c417fc langref: reword some packed struct text and example 2025-04-15 19:19:23 -07:00
kj4tmp@gmail.com
a8621731ec langref: packed struct documentation 2025-04-15 19:17:07 -07:00
Андрей Краевский
aac800ec65
std.meta.FieldType -> @FieldType 2025-03-27 03:49:38 +00:00
Kiëd Llaentenn
5f7dfc3577 langref: update splat section 2025-03-06 07:26:19 +01:00
Andrew Kelley
5ad91a646a Release 0.14.0 2025-03-04 14:31:02 -08:00
Andrew Kelley
6b6c1b1b0e Revert "Merge pull request #22898 from kristoff-it/deprecated-proposal"
This reverts commit dea72d15da, reversing
changes made to ab381933c8.

The changeset does not work as advertised and does not have sufficient
test coverage.

Reopens #22822
2025-02-28 01:37:10 -08:00
Andrew Kelley
4ddb13468b langref: update deprecated section 2025-02-26 14:41:33 -05:00
Andrew Kelley
7c2649f89d langref: fix whitespace 2025-02-26 14:41:33 -05:00
Loris Cro
e3da2852f4 @deprecated: add suggested changes to langref entry 2025-02-26 14:41:33 -05:00
Loris Cro
06a66745a0 @deprecated: add langref entry 2025-02-26 14:41:33 -05:00
mlugg
cc64295a63
langref: document modules, root source files, etc 2025-02-22 21:01:44 +00:00
mlugg
f0b331e95a
langref: embrace the term "illegal behavior"
Also standardise the terms "safety-checked" and "unchecked".
2025-02-22 21:01:44 +00:00
mlugg
def7e2f20a
langref: improve description of @fieldParentPtr 2025-02-22 21:01:44 +00:00
Frank Plowman
bf7bc4ff01 langref/errorset: Replace subset description with union
The previous language using subsets was really just stating a couple
of the properties of the union of a group of sets, and with a minor
error at that.
2025-02-07 03:38:44 +01:00
mlugg
249a20d972 langref: clarify restricted @memcpy semantics 2025-01-29 18:43:57 +00:00
87
183bb8b084
langref: Document destructuring (#21627) 2025-01-28 04:23:13 +00:00
isaac yonemoto
ae5b1a9ca2 langref: fixes incorrect description of cmpxchg functions 2025-01-26 23:22:04 +01:00
bsubei
3f245616a5 link to Tuples section in Hello World docs, and give an example of an empty tuple 2025-01-26 20:53:25 +01:00
rpkak
9c45fb4b09 langref: correct return type of comptime known bitcount ops 2025-01-26 20:30:06 +01:00
kj4tmp@gmail.com
6255ee3d2f fix typo in @typeName langref 2025-01-26 19:40:57 +01:00
ExeVirus
738d813619
Add zig std to langref.html (#22360) 2025-01-26 18:58:30 +01:00
Andrew Kelley
6d67658965 langref: move pointer casting section out of volatile subsection 2024-12-30 22:05:30 -08:00
Andrew Kelley
3ce6de8765 revert langref section "common errdefer slip ups"
This does not belong in the language reference.

reverts 91a88a789f
2024-11-26 15:03:24 -08:00
llogick
985b13934d Remove @setAlignStack from the langref 2024-10-25 15:13:41 +02:00
mlugg
097766bba3 compiler: implement @FieldType
Resolves: #21702
2024-10-18 08:50:40 +01:00
wooster0
816dfca0b5 langref: update builtin variadic functions
Documentation was outdated.
2024-10-17 11:51:06 +03:00
David Rubin
e131a2c8e2
implement packed struct equality (#21679) 2024-10-12 20:59:12 -07:00
David Rubin
043b1adb8d
remove @fence (#21585)
closes #11650
2024-10-04 22:21:27 +00:00
PauloCampana
3e62cb5c90
Remove old deprecated symbols in std (#21584)
Also, actually run tests inside std/tar/writer.zig
2024-10-04 13:50:25 -07:00
LiterallyVoid
cf69154332
Labeled switch documentation (#21383)
Add langref docs for labeled switch

This feature was proposed in #8220, and implemented in #21257.

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2024-09-12 20:06:49 -07:00