22626 Commits

Author SHA1 Message Date
mlugg
b8a96baab8
Improve multi-module error messages
- Fix assertion failure if AstGen failed on a multi-module file
- Cap number of per-error reference notes and total multi-module errors each at 5
- Always put "root of package" reference notes first

Resolves: #14499
2023-02-21 02:05:35 +00:00
mlugg
09a84c8384
Update std.Build to new module CLI, update zig1 and CMakeLists
Resolves: #14667
2023-02-21 01:59:37 +00:00
mlugg
705d2a3c2c
Implement new module CLI 2023-02-21 01:59:37 +00:00
Jakub Konka
dc1f50e505
Merge pull request #14685 from ziglang/bitcast-fixes
Bitcast fixes for self-hosted native backends
2023-02-20 23:01:21 +01:00
Andrew Kelley
a933a59ced
Merge pull request #14682 from ziglang/stage1-coverage
add test coverage for fixed stage1 bugs
2023-02-20 14:23:37 -05:00
Frank Denis
6214f66dc1 trim(Left|Right): clarify that values_to_strip is a set
The parameter could be confused with a prefix or suffix, instead
of a set of values.
2023-02-20 13:55:45 -05:00
Frank Denis
5a7d80a5e7
Linker: -z<arg> should be equivalent to -z <arg> (#14680)
lld accepts both syntaxes, but we were rejecting (and, before
3f7e9ff597a3514bb1c4f1900027c40682ac9f13, ignoring) the former.

In particular, "cargo-zigbuild" was broken since Rust
unconditionally adds "-znoexecstack" (not "-z noexecstack")
on non-Windows platforms.

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2023-02-20 16:15:21 +00:00
Loris Cro
99c11cc8cf
Merge pull request #14544 from der-teufel-programming/autodoc-quickfixes
autodoc: main.js cleanup and formatting
2023-02-20 16:37:41 +01:00
Loris Cro
dfd182cc7a
Merge pull request #14655 from McSinyx/md-ol
autodoc: fix markdown list rendering
2023-02-20 16:33:00 +01:00
Jakub Konka
0aee40bd13 riscv64+sparc64: alloc new mcv in bitcast if cannot reuse operand 2023-02-20 12:19:40 +01:00
Jakub Konka
528c43233f arm: alloc new mcv in bitcast if cannot reuse operand 2023-02-20 12:13:14 +01:00
Jakub Konka
59a9373c71 aarch64: alloc new mcv in bitcast if cannot reuse operand 2023-02-20 10:52:34 +01:00
Jakub Konka
87d358024f re-enable x86_64-linux self-hosted behaviour test suite 2023-02-20 10:52:34 +01:00
Jakub Konka
a7de8dc2dd x86: alloc new mcv in bitcast if cannot reuse operand
Implement missing pointees when ptr is in register.
2023-02-20 10:52:26 +01:00
Andrew Kelley
ec4cd87ed7 add test coverage for fixed bug. closes #5518 2023-02-19 21:18:27 -07:00
Andrew Kelley
e778e47140 add test coverage for fixed bug. closes #5516 2023-02-19 21:18:27 -07:00
Andrew Kelley
680d79ebf9 add test coverage for fixed bug. closes #5508 2023-02-19 21:18:27 -07:00
Andrew Kelley
ffdce5f98c add test coverage for fixed bug. closes #5497 2023-02-19 21:18:27 -07:00
Andrew Kelley
53104b9165 add test coverage for fixed bug. closes #5410 2023-02-19 21:18:27 -07:00
Jan Philipp Hafer
476bdc8b0b compiler_rt: restructure compiler_rt.zig according to README.md
Justifications
- compiler_rt base routines are almost finished, so make 1:1
mapping of code and documentation.
- Make adjustments to code + documentation simpler to prevent technical or
  documentation debt.
2023-02-19 14:00:55 -05:00
Andrew Kelley
adfc019d60
Merge pull request #11982 from marler8997/ignoreSigpipe
ignore SIGPIPE by default
2023-02-19 13:55:12 -05:00
Veikka Tuominen
f10950526e implement writeToMemory/readFromMemory for pointers 2023-02-19 13:54:52 -05:00
Andrew Kelley
02f5d2673f Revert "Merge pull request #14661 from evacchi/zig-wasi-preopens"
This reverts commit 772a0eb68ac95b7e24508580499b49872fdb541f, reversing
changes made to 0bb178bbb2451238a326c6e916ecf38fbc34cab1.

This needs a rebase against master branch - it has build-breaking merge
conflicts. I also added a "changes requested" review on the original
pull request.
2023-02-19 09:40:55 -07:00
Luuk de Gram
772a0eb68a
Merge pull request #14661 from evacchi/zig-wasi-preopens 2023-02-19 17:09:58 +01:00
Andrew Kelley
0bb178bbb2
Merge pull request #14671 from ziglang/multi-object-for
implement multi-object for loops
2023-02-19 10:10:59 -05:00
Tom Read Cutting
346ec15c50
Correctly handle carriage return characters according to the spec (#12661)
* Scan from line start when finding tag in tokenizer

This resolves a crash that can occur for invalid bytes like carriage
returns that are valid characters when not parsed from within literals.

There are potentially other edge cases this could resolve as well, as
the calling code for this function didn't account for any potential
'pending_invalid_tokens' that could be queued up by the tokenizer from
within another state.

* Fix carriage return crash in multiline string

Follow the guidance of #38:

> However CR directly before NL is interpreted as only a newline and not part of the multiline string. zig fmt will delete the CR.

Zig fmt already had code for deleting carriage returns, but would still
crash - now it no longer does so. Carriage returns encountered before
line-feeds are now appropriately removed on program compilation as well.

* Only accept carriage returns before line feeds

Previous commit was much less strict about this, this more closely
matches the desired spec of only allow CR characters in a CRLF pair, but
not otherwise.

* Fix CR being rejected when used as whitespace

Missed this comment from ziglang/zig-spec#83:

> CR used as whitespace, whether directly preceding NL or stray, is still unambiguously whitespace. It is accepted by the grammar and replaced by the canonical whitespace by zig fmt.

* Add tests for carriage return handling
2023-02-19 14:14:03 +02:00
The Potato Chronicler
281d4c0ff6
Fix grammatical error in doc comment 2023-02-19 14:12:09 +02:00
Andrew Kelley
5fc6bbe71e update zig1.wasm 2023-02-18 19:20:19 -07:00
Andrew Kelley
15d767c621 add safety test cases for multi-object for loops 2023-02-18 19:20:19 -07:00
Andrew Kelley
40c4c25e2b Sema: add missing coercion when checking for loop len 2023-02-18 19:20:19 -07:00
Andrew Kelley
12a7a0d76f omit safety check when incrementing for loop counter
Since for loops are statically analyzed to have an upper bound, and the
loop counter is a usize, it is impossible for it to overflow.
2023-02-18 19:20:19 -07:00
Andrew Kelley
8b05205bb7 implement error for unbounded for loops 2023-02-18 19:20:19 -07:00
Andrew Kelley
e89bfedd8d update compare-output test case to new for loop syntax 2023-02-18 19:20:19 -07:00
Andrew Kelley
74db8c2e83 omit safety checks for element access in for loops
One of the main points of for loops is that you can safety check the
length once, before entering the loop, and then safely assume that every
element inside the loop is in bounds.

In master branch, the safety checks are incorrectly intact even inside
for loops. This commit fixes it. It's especially nice with multi-object
loops because the number of elided checks is N * M where N is how many
iterations and M is how many objects.
2023-02-18 19:20:19 -07:00
Andrew Kelley
7abeb52abc langref: update to new for loop syntax 2023-02-18 19:20:19 -07:00
Andrew Kelley
4dd958d585 improve error message for byref capture of byval array 2023-02-18 19:20:19 -07:00
Andrew Kelley
601db3981c fix source location for not-indexable for loop errors 2023-02-18 19:20:19 -07:00
Andrew Kelley
bcb72401d3 AstGen: add error for discard of unbounded counter 2023-02-18 19:17:21 -07:00
Andrew Kelley
22965e6fcb Sema: improve error message for mismatched for loop lengths 2023-02-18 19:17:21 -07:00
Andrew Kelley
b13745ac03 disable failing x86_64 backend tests 2023-02-18 19:17:21 -07:00
Andrew Kelley
209e83f395 AstGen: fix ZIR for for loops accessing instruction out of block 2023-02-18 19:17:21 -07:00
Andrew Kelley
8c96d0dddd update test-cases for new for loop syntax 2023-02-18 19:17:21 -07:00
Andrew Kelley
b6a5e52dec add passing for loop test: two counters 2023-02-18 19:17:21 -07:00
Andrew Kelley
f2a6a1756b Sema: fix for loops with comptime-known int ranges 2023-02-18 19:17:21 -07:00
Andrew Kelley
552e8095ae update docgen to new for loop syntax 2023-02-18 19:17:21 -07:00
Andrew Kelley
a005b5f198 add zig fmt test for upgrading for loop syntax 2023-02-18 19:17:21 -07:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
Andrew Kelley
f0530385b5 update existing behavior tests and std lib to new for loop semantics 2023-02-18 19:17:21 -07:00
Andrew Kelley
321ccbdc52 Sema: implement for_len
This also makes another breaking change to for loops: in order to
capture a pointer of an element, one must take the address of array
values. This simplifies a lot of things, and makes more sense than how
it was before semantically.

It is still legal to use a for loop on an array value if the
corresponding element capture is byval instead of byref.
2023-02-18 19:17:21 -07:00
Andrew Kelley
5029e5364c make zig fmt perform upgrade to new for loop syntax
The intent here is to revert this commit after Zig 0.10.0 is released.
2023-02-18 19:17:21 -07:00