34 Commits

Author SHA1 Message Date
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
Andrew Barchuk
5b4759bd3c Clarify the multidimensional array example
Use a rectangular matrix instead of a square one to distinguish rows and
columns more clearly. Extend the example with row access.
2025-03-26 11:52:52 +01:00
Kiëd Llaentenn
5f7dfc3577 langref: update splat section 2025-03-06 07:26:19 +01:00
Linus Groh
79460d4a3e Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
Andrew Kelley
6b6c1b1b0e Revert "Merge pull request #22898 from kristoff-it/deprecated-proposal"
This reverts commit dea72d15da4fba909dc3ccb2e9dc5286372ac023, reversing
changes made to ab381933c87bcc744058d25a876cfdc0d23fc674.

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

Reopens #22822
2025-02-28 01:37:10 -08: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
Meghan Denny
933ba935c5
std.BoundedArray: popOrNull() -> pop() [v2] (#22723) 2025-02-09 11:46:15 +00:00
87
183bb8b084
langref: Document destructuring (#21627) 2025-01-28 04:23:13 +00:00
Andrew Kelley
3ce6de8765 revert langref section "common errdefer slip ups"
This does not belong in the language reference.

reverts 91a88a789ffa80ebb57c77ae0fe37594276e3707
2024-11-26 15:03:24 -08:00
Andrew Kelley
bfcf18c5a7 langref: delete misleading example code about packed structs 2024-11-13 15:35:16 -08:00
Roman Frołow
c39ba682e3 typo: will inlined -> will be inlined 2024-10-29 17:52:55 -07:00
mlugg
04ffc1c963
langref: update enum_export_error.zig for callconv changes 2024-10-19 19:21:33 +01:00
David Rubin
e131a2c8e2
implement packed struct equality (#21679) 2024-10-12 20:59:12 -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
Linus Groh
8588964972 Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
Jesse Wattenbarger
218cf059dd remove explicit ComplexTypeTag from switch 2024-09-10 20:28:40 -07:00
mlugg
0fe3fd01dd
std: update std.builtin.Type fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
2024-08-28 08:39:59 +01:00
mlugg
6808ce27bd
compiler,lib,test,langref: migrate @setCold to @branchHint 2024-08-27 00:44:35 +01:00
mlugg
a3a737e9a6
lib,test,tools,doc: update usages of @export 2024-08-27 00:44:35 +01:00
T
eb7f318ea8
langref: clarify functionality of the round builtin (#19503)
A test has also been added to demonstrate the expected behavior.

* std.math: update round doc comment to match the builtin
2024-08-14 10:29:45 -07:00
Ryan Liptak
73a444766e langref: Make pointer_coerce_const_optional test less obfuscated
This test was originally introduced in 5f38d6e2e97829ed74f06a96b5d07a2c68516063, where it looked like this:

    test "cast *[1][*]const u8 to [*]const ?[*]const u8" {
        const window_name = [1][*]const u8{c"window name"};
        const x: [*]const ?[*]const u8 = &window_name;
        assert(mem.eql(u8, std.cstr.toSliceConst(x[0].?), "window name"));
    }

Over the years, this has become more and more obfuscated, to the point that the verbosity of the `expect` call overshadows the point of the example. This commit intends to update this test to match the spirit of the original version of the test, while shedding the obfuscation.
2024-07-29 16:07:12 -07:00
Alex Kladov
8267929742 langref: add example for errdefer |err| sytnax 2024-07-21 01:26:21 -07:00
ssmid
9232425b8f single pointer slice syntax added 2024-07-21 00:32:50 -07:00
Wooster
888708ec8a
Sema: support pointer subtraction 2024-07-15 18:18:38 +00:00
Jora Troosh
13070448f5
std: fix typos (#20560) 2024-07-09 14:25:42 -07:00
Gordon Cassie
24f28753e6
Document a few non-obvious variable assignments (#20213)
Provide examples of various initializations.
2024-06-08 12:39:11 -07:00
Andrew Kelley
9be8a9000f Revert "implement @expect builtin (#19658)"
This reverts commit a7de02e05216db9a04e438703ddf1b6b12f3fbef.

This did not implement the accepted proposal, and I did not sign off
on the changes. I would like a chance to review this, please.
2024-05-22 09:57:43 -07:00
David Rubin
a7de02e052
implement @expect builtin (#19658)
* implement `@expect`

* add docs

* add a second arg for expected bool

* fix typo

* move `expect` to use BinOp

* update to newer langref format
2024-05-22 10:51:16 -05:00
Pyrolistical
cb77bd672c [docs] add examples of array/slice init using result location 2024-05-10 13:56:01 -07:00
Jacob Young
e3424332d3 Build: cleanup
* `doc/langref` formatting
 * upgrade `.{ .path = "..." }` to `b.path("...")`
 * avoid using arguments named `self`
 * make `Build.Step.Id` usage more consistent
 * add `Build.pathResolve`
 * use `pathJoin` and `pathResolve` everywhere
 * make sure `Build.LazyPath.getPath2` returns an absolute path
2024-05-05 09:42:51 -04:00
Andrew Kelley
1b90888f57 migrate langref documentation generation to the build system 2024-04-25 00:09:24 -07:00