Commit Graph

586 Commits

Author SHA1 Message Date
Meghan
7e52a096db
langref- fix packed struct error code 2021-08-01 12:42:48 +03:00
Meghan
32069d2330
langref- fix use after block error code 2021-08-01 12:42:05 +03:00
Andrew Kelley
dc88864c97 stage2: implement @boolToInt
This is the first commit in which some behavior tests are passing for
both stage1 and stage2.
2021-07-27 17:08:37 -07:00
Robin Voetter
cdeea3b094 minimum/maximum builtins 2021-07-26 20:41:00 -04:00
Robin Voetter
50a29f7c21 Add @select
@select(
    comptime T: type,
    pred: std.meta.Vector(len, bool),
    a: std.meta.Vector(len, T),
    b: std.meta.Vector(len, T)
) std.meta.Vector(len, T)

Constructs a vector from a & b, based on the values in the predicate vector. For indices where the predicate value is true, the corresponding
element from the a vector is selected, and otherwise from b.
2021-07-26 20:05:48 -04:00
Auguste Rame
dd796154be Doc fixes for clz + ctz 2021-07-25 22:58:58 -04:00
Auguste Rame
ecca829bcb Add vector support for @popCount 2021-07-25 20:35:55 -04:00
David May
e5b476209a
Docs fix array/pointer/slice type coercion section (#9392)
* removed deprecated coercion: [X]T => [] const T

* Fixed tests and added desc for first test

* Improved heading
2021-07-23 09:32:20 +03:00
Isaac Freund
00e944f718 langref: remove incorrect statement on c_void
c_void is *not* simply `const c_void = opaque{};`. It has unique
semantics as any pointer type may coerce to `*c_void` which is not true
for an arbitrary `*opaque{}`.
2021-07-19 20:03:26 -04:00
Jonathan Marler
9086452ff9 clarify @bitSizeOf behavior 2021-07-13 10:14:39 +03:00
Mr. Paul
a201d80253 Introduce Zig Test earlier in Language Reference
The "Zig Test" section of the language reference has been moved between the
current "Hello World" section and the "Comments" section. This was done to
introduce the Zig test syntax before it is used in later sections.

The description of the Zig test feature has NOT been updated in this commit.

Closes #5837
2021-07-08 14:33:53 -04:00
yetanothercheer
7935e83b1d Fix indentation in langref.html.in 2021-07-08 00:05:29 -04:00
Andrew Kelley
b7da1b2d45
Merge pull request #9175 from kprotty/thread
std.Thread enhancements
2021-07-04 22:31:02 -04:00
Nulo
5d0dad9acd Link to the GPA now that it's on upstream 2021-07-04 15:44:29 -04:00
Andrew Kelley
a6bf68ccf9 langref: fix test cases now that AST Lowering has priority 2021-07-02 16:22:09 -07:00
Andrew Kelley
22b20f20b6 AstGen: fix missing compile error for unreachable @TypeOf argument 2021-07-02 13:26:50 -07:00
kprotty
f0fa129e9b std.Thread: more cleanup & testing 2021-06-30 21:49:00 -05:00
Andrew Kelley
06129d7e3d std: implement a cross platform file locking abstraction
This modifies the lock semantics from using AccessMode to using
NtLockFile/NtUnlockFile.

This is a breaking change.
2021-06-29 14:25:04 -07:00
Evan Haas
3be682bac9
translate-c: Add documentation for zig translate-c 2021-06-27 12:25:32 +03:00
Jacob G-W
4adcd560ce langref: make @setRuntimeSafety more correct 2021-06-25 08:57:03 +03:00
Andrew Kelley
3259532080 langref: fix unused vars 2021-06-23 11:32:28 -07:00
Veikka Tuominen
29945fb8b3 fix typos in langref.html
I thought I built the docs locally but apparently not.
2021-06-23 09:20:39 +03:00
Roman Frołow
ce3679aa45
Docs clarification: local static variable (#8381) 2021-06-23 08:45:36 +03:00
Jacob G-W
da063ebd96 docs: top level global assembly -> container level 2021-06-23 08:44:52 +03:00
Daniele Cocca
9e88356282 embedFile: change notation from [X:0] to [N:0]
This is for consistency with the documentation on sentinel-terminated
{arrays,slices,pointers} which already use `N` for a comptime-inferred
size rather than `X`.

Also adds a behavioral test to assert that a string literal is returned.
2021-06-16 22:03:02 +01:00
Daniele Cocca
9be2f76741 typeName: amend return type to string literal
This was already the case, but the documentation failed to point out
that the returned value is of type `*const [N:0]u8`, i.e. that of a
string literal.

Also adds a behavioral test to assert that this is the case.
2021-06-16 22:03:02 +01:00
Daniele Cocca
171102ea7c errorName: return a null-terminated slice 2021-06-16 22:02:52 +01:00
Daniele Cocca
00e1c0082c tagName: return a null-terminated slice 2021-06-16 22:02:42 +01:00
Andrew Kelley
515d6430c0 AstGen: support @export with field access
The Zig language specification will support identifiers and field access
in order to refer to which declaration to export with `@export`.

This commit implements the change in AstGen and updates the language
reference.
2021-06-15 14:08:57 -07:00
Jarred Sumner
540b52931a Improve error message when std.fmt.format is missing arguments
Use fmt in fmt so the number in the error message is fmt'd
2021-06-13 10:33:49 +03:00
Exonorid
f63338195d Renamed @byteOffsetOf to @offsetOf 2021-06-12 19:16:01 +03:00
Norberto Martínez
9f8d1a9ff3 Documentation TOC item color changed 2021-06-10 22:12:46 +03:00
Andrew Kelley
f62f35e346 langref: link to 0.7.1 not 0.7.0 for the previous docs 2021-06-09 11:17:43 -07:00
Andrew Kelley
87562b50fc langref: remove paragraph that mentions IRC
I want the language reference to be divorced from any particular
community. Also remove the call to action since the docs are
known to be incomplete and are not the current focus of the project.

Closes #9055
2021-06-09 11:15:30 -07:00
Andrew Kelley
a642552faf Release 0.8.0 2021-06-04 11:21:32 -07:00
Isaac Freund
05b677f0c4 langref: sync grammar with zig-spec repo 2021-06-04 01:18:45 -04:00
viri
ce072894a1 docs: minor spelling fix 2021-06-04 01:18:14 -04:00
Matthew Borkowski
b01e5d9301 fix position of .* and .? in operator precedence table documentation 2021-05-25 00:09:28 -04:00
Matthew Borkowski
46d8e010a0 fix position of orelse and catch in precedence table and remove misplaced error union operator 2021-05-24 16:58:20 -04:00
Jakub Konka
fbd96907c9 wasm: build static archive unless -dynamic specified
This matches the behaviour for other targets in that

```
zig build-lib math.zig -target wasm32-freestanding
```

produces now `libmath.a` while

```
zig build-lib math.zig -dynamic -target wasm32-freestanding
```

is required to create a loadable Wasm module.
2021-05-21 20:24:13 +02:00
Jakub Konka
3a5d0f7700 wasm: link dynamically by default when targeting wasm
This matches the behaviour of other languages and leaves us
the ability to create actual static Wasm archives with

```
zig build-lib -static some.zig
```

which can then be combined with other Wasm object files and linked
into either a Wasm lib or executable using `wasm-ld`.

Update langref to reflect the fact we now ship WASI libc.
2021-05-20 16:54:00 +02:00
Andrew Kelley
8cfa231104 update langref, compile-error tests, safety tests
for the std.builtin re-arranging
2021-05-17 15:25:27 -07:00
Andrew Kelley
5619ce2406 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * doc/langref.html.in
 * lib/std/enums.zig
 * lib/std/fmt.zig
 * lib/std/hash/auto_hash.zig
 * lib/std/math.zig
 * lib/std/mem.zig
 * lib/std/meta.zig
 * test/behavior/alignof.zig
 * test/behavior/bitcast.zig
 * test/behavior/bugs/1421.zig
 * test/behavior/cast.zig
 * test/behavior/ptrcast.zig
 * test/behavior/type_info.zig
 * test/behavior/vector.zig

Master branch added `try` to a bunch of testing function calls, and some
lines also had changed how to refer to the native architecture and other
`@import("builtin")` stuff.
2021-05-08 14:45:21 -07:00
Veikka Tuominen
08b6baca12 update usage of std.testing in langref.html 2021-05-08 15:16:05 +03:00
Andrew Kelley
dc28f5c3ec Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
	lib/std/crypto/25519/field.zig
	lib/std/crypto/poly1305.zig

I had resolved those by removing `comptime` but master branch decided to
make the parameters `comptime`.

This also pulls in the updated default `zig build` install directory.
2021-04-30 23:13:17 -07:00
Devin Bayer
5fcc922ff2
add doc in Anonymous Struct Literal section for special @"0" syntax. (#8630) 2021-05-01 01:05:45 +02:00
Frank Denis
33cb660838
Doc: zig-cache/bin -> zig-out/bin (#8659) 2021-05-01 00:41:59 +02:00
Andrew Kelley
e86cee258c Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
In particular I wanted the change that makes `suspend;` illegal in the
parser.
2021-04-24 10:44:41 -07:00
LemonBoy
0aede1a8fc stage1: Require a block after suspend
Closes #8603
2021-04-24 10:25:43 +02:00
Andrew Kelley
8dd7378013 delete packed enums from the language
No need for any such thing. Instead, provide an integer tag type for the
enum.
2021-04-22 19:21:50 -07:00