aboutsummaryrefslogtreecommitdiff
path: root/doc
AgeCommit message (Collapse)Author
2025-10-26docs: fix handle_error_with_catch_block typoFelipe Cardozo
2025-10-17langref: Bump 0.15.1 to 0.15.2Ryan Liptak
2025-09-20langref: don't assume too much about pointer to packed struct fieldAndrew Kelley
2025-09-18langref: runtime_shrExact_overflow does not work as expected on LoongArchAlex Rønne Petersen
https://github.com/ziglang/zig/issues/24304
2025-09-17langref: mention union support of `@fieldParentPtr`rohlem
2025-09-10langref: added missing newlines to destructuring tuples exampleLukaTD
langref: added missing newlines to destructuring tuples example
2025-09-07frontend: vectors and arrays no longer support in-memory coercionAndrew Kelley
closes #25172
2025-09-06Merge pull request #25163 from ziglang/packed-union-unusedAndrew Kelley
forbid unused bits in packed unions
2025-09-06langref: update "Choosing an Allocator" sectionAndrew Kelley
and delete "Implementing an Allocator" section because it is out of scope.
2025-09-05langref: update for new packed union rulesAndrew Kelley
2025-08-21langref: update nav linkAndrew Kelley
2025-08-21langref: sync with zig-spec grammar.pegIsaac Freund
2025-08-18Release 0.15.00.15.0Andrew Kelley
2025-08-17langref: add documentation for unions with inferred tag and explicit tag valuesJustus Klausecker
2025-08-12Sema: Improve comptime arithmetic undef handlingJustus Klausecker
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-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-05std: remove BoundedArrayAndrew Kelley
This use case is handled by ArrayListUnmanaged via the "...Bounded" method variants, and it's more optimal to share machine code, versus generating multiple versions of each function for differing array lengths.
2025-07-31langref: improve `@import` documentationmlugg
Rewrite to be more clear and correct. Also, explain ZON imports. Resolves: #23314
2025-07-31Merge pull request #24537 from IOKG04/some-documentation-updates-0Matthew Lugg
some small langref changes
2025-07-30langref: clarify allowed atomic typesKendall Condon
Floats are not allowed in @cmpxchg Packed structs are allowed for all atomic builtins
2025-07-28`.strong`, not `.Strong`IOKG04
https://github.com/ziglang/zig/pull/24537#issuecomment-3124556900
2025-07-28Merge branch 'ziglang:master' into some-documentation-updates-0Rue
2025-07-26Migrate from deprecated `Step.Compile` APIsCarl Åstholm
2025-07-22`@rem()` and `@mod()` take `denominator != 0`, not just `denominator > 0`IOKG04
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-22error return traces are *not* enabled for ReleaseSafeIOKG04
https://github.com/ziglang/zig/issues/24232
2025-07-22`[:x]T` coerces into `[*:x]T`IOKG04
https://github.com/ziglang/zig/issues/9628
2025-07-20langref: upgrade grammar.y for asm clobber changeKendall Condon
2025-07-16update docsAndrew Kelley
2025-07-14langref: remove dead codeAlex Kladov
2025-07-14langref: don't encourage printing to stderr in testsAlex Kladov
The rule: `pub fn main` owns file descriptors 0, 1, and 2. If you didn't write `pub fn main()` it is, in general, not your business to print to stderr.
2025-07-14langref: make example more interesting.Alex Kladov
As written, I think langref's example is actually a poor reason to use `inline`. If you have if (foo(1200, 34) != 1234) { @compileError("bad"); } and you want to make sure that the call is executed at compile time, the right way to fix it is to add comptime if (comptime foo(1200, 34) != 1234) { @compileError("bad"); } and not to make the function `inline`. I _think_ that inlining functions just to avoid `comptime` at a call-site is an anti-pattern. When the reader sees `foo(123)` at the call-site, they _expect_ this to be a runtime call, as that's the normal rule in Zig. Inline is still necessary when you can't make the _whole_ call `comptime`, because it has some runtime effects, but you still want comptime-known result. A good example here is inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, comptime dep_name: []const u8) []const u8 { from Build.zig, where the `b` argument is runtime, and is used for side-effects, but where the result is comptime. I don't know of a good small example to demonstrate the subtelty here, so I went ahead with just adding a runtime print to `foo`. Hopefully it'll be enough for motivated reader to appreciate the subtelty!
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-07-07update standalone and incremental tests to new APIAndrew Kelley
2025-07-07remove `usingnamespace` from the languageAndrew Kelley
closes #20663
2025-07-07remove `async` and `await` keywordsAndrew Kelley
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-01langref: runtime_shrExact_overflow does not work as expected on RISC-VAlex Rønne Petersen
https://github.com/ziglang/zig/issues/24304
2025-06-12Allow more operators on bool vectors (#24131)Daniel Kongsgaard
* 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-07Merge pull request #24072 from jacobly0/x86_64-defaultAndrew Kelley
Compilation: enable the x86_64 backend by default for debug builds
2025-06-07langref: undefined _is_ materialized in all safe modes (#24107)Alex Kladov
* 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-06langref: global assembly test depends on llvmAndrew Kelley
see #24046
2025-06-01compiler: combine `@intCast` safety checksmlugg
`castTruncatedData` was a poorly worded error (all shrinking casts "truncate bits", it's just that we assume those bits to be zext/sext of the other bits!), and `negativeToUnsigned` was a pointless distinction which forced the compiler to emit worse code (since two separate safety checks were required for casting e.g. 'i32' to 'u16') and wasn't even implemented correctly. This commit combines those safety panics into one function, `integerOutOfBounds`. The name maybe isn't perfect, but that's not hugely important; what matters is the new default message, which is clearer than the old ones: "integer does not fit in destination type".
2025-05-30langref: Update calling convention (#24022)Felix Rabe
* langref: Update calling convention * Apply suggestions from code review Co-authored-by: Alex Rønne Petersen <alex@alexrp.com> * langref: Just use .winapi directly --------- Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-05-23langref: update nav link for 0.14.1Andrew Kelley
2025-04-26langref: document @memmovedweiller
2025-04-15langref: reword some packed struct text and exampleAndrew Kelley
2025-04-15langref: packed struct documentationkj4tmp@gmail.com
2025-03-27std.meta.FieldType -> @FieldTypeАндрей Краевский
2025-03-26Clarify the multidimensional array exampleAndrew Barchuk
Use a rectangular matrix instead of a square one to distinguish rows and columns more clearly. Extend the example with row access.
2025-03-06langref: update splat sectionKiëd Llaentenn
2025-03-05Remove uses of deprecated callconv aliasesLinus Groh