Commit Graph

11 Commits

Author SHA1 Message Date
Ryan Liptak
73a444766e langref: Make pointer_coerce_const_optional test less obfuscated
This test was originally introduced in 5f38d6e2e9, 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 a7de02e052.

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