aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
AgeCommit message (Collapse)Author
2023-02-21Improve multi-module error messagesmlugg
- 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-21Implement new module CLImlugg
2023-02-18improve error message for byref capture of byval arrayAndrew Kelley
2023-02-18Sema: improve error message for mismatched for loop lengthsAndrew Kelley
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-02-13move the cache system from compiler to std libAndrew Kelley
2023-02-05make `@embedFile` support module-mapped names the same way as `@import`Andrew Kelley
closes #14553
2023-02-03link: remove `FnData` and make it self-ownedLuuk de Gram
This finishes the work started in #14502 where atoms are owned by the linker themselves. This now makes debug atoms fully owned by dwarf, and no information is left stored on the decl.
2023-02-03introduce ZON: Zig Object NotationAndrew Kelley
* std.zig.parse is moved to std.zig.Ast.parse * the new function has an additional parameter that requires passing Mode.zig or Mode.zon * moved parser.zig code to Parse.zig * added parseZon function next to parseRoot function
2023-02-01link: remove union types which are now internal to backendsJakub Konka
2023-02-01link: make Wasm atoms fully owned by the linkerLuuk de Gram
2023-02-01link: make SpirV atoms fully owned by the linkerJakub Konka
2023-02-01link: decouple DI atoms from linker atoms, and manage them in Dwarf linkerJakub Konka
2023-02-01link: make Plan9 atoms fully owned by the linkerJakub Konka
2023-01-31link: make Coff atoms fully owned by the linkerJakub Konka
2023-01-31link: make Elf atoms fully owned by the linkerJakub Konka
2023-01-31link: make MachO atoms fully owned by the linkerJakub Konka
2023-01-27self-hosted: remove allocateDeclIndexes from the public link.File APIJakub Konka
2023-01-27wasm: migrate to new non-allocateDeclIndexes APILuuk de Gram
2023-01-26coff: migrate to new non-allocateDeclIndexes APIJakub Konka
2023-01-26elf: migrate to new non-allocateDeclIndexes APIJakub Konka
2023-01-26macho: completely remove allocateDeclIndexes in favor of linker trackingJakub Konka
2023-01-22AstGen: detect and error on files included in multiple packagesmlugg
Previously, if a source file was referenced from multiple packages, it just became owned by the first one AstGen happened to reach; this was a problem, because it could lead to inconsistent behaviour in the compiler based on a race condition. This could be fixed by just analyzing such files multiple times - however, it was pointed out by Andrew that it might make more sense to enforce files being part of at most a single package. Having a file in multiple packages would not only impact compile times (due to Sema having to run multiple times on potentially a lot of code) but is also a confusing anti-pattern which more often than not is a mistake on the part of the user. Resolves: #13662
2023-01-22Package: store package name directlymlugg
By @Vexu's suggestion, since fetching the name from the parent package is error-prone and complex, and optimising Package for size isn't really a priority.
2023-01-16Sema: automatically optimize order of struct fieldsVeikka Tuominen
This is a simple starting version of the optimization described in #168 where the fields are just sorted by order of descending alignment.
2023-01-11Sema: fix typeInfo decls with usingnamespaceVeikka Tuominen
Closes #12403
2023-01-09std: add helper functions to std.zig.Ast for extracting data out of nodesTechatrix
2023-01-05Sema: handle enum expressions referencing local variablesVeikka Tuominen
Closes #12272
2023-01-05Sema: remove generic function from `monomorphed_funcs` on any errorVeikka Tuominen
2023-01-05Sema: add system for checking backend feature supportVeikka Tuominen
2023-01-03Sema: do not immediately destroy failed generic instantiationVeikka Tuominen
Closes #12535 Closes #12765 Closes #12927
2022-12-30fix generic function arg debug info referencing wrong parameterVeikka Tuominen
Closes #14123
2022-12-14stage2: remove `pub` from a private functionAndrew Kelley
2022-12-14std.fs.Dir.statFile reworkAndrew Kelley
* revert changes to Module because the error set is consistent across operating systems. * remove duplicated Stat.fromSystem code and use a less redundant name. * make fs.Dir.statFile follow symlinks, and avoid pointless control flow through the posix layer.
2022-12-14std.fs.Dir.statFile: use fstatatPhilippe Pittoli
This avoids extra syscalls.
2022-12-14Sema: display cimport errors from clangVeikka Tuominen
2022-12-11Add a helpful note when using `**` on number types. (#13871)IntegratedQuantum
2022-12-06remove most conditional compilation based on stage1Andrew Kelley
There are still a few occurrences of "stage1" in the standard library and self-hosted compiler source, however, these instances need a bit more careful inspection to ensure no breakage.
2022-12-02Sema: add error for failed assumption about struct having runtime bitsVeikka Tuominen
2022-11-29std.mem.Allocator: allow shrink to failAndrew Kelley
closes #13535
2022-11-28CLI: more careful resolution of pathsAndrew Kelley
In general, we prefer compiler code to use relative paths based on open directory handles because this is the most portable. However, sometimes absolute paths are used, and sometimes relative paths are used that go up a directory. The recent improvements in 81d2135ca6ebd71b8c121a19957c8fbf7f87125b regressed the use case when an absolute path is used for the zig lib directory mixed with a relative path used for the root source file. This could happen when, for example, running the standard library tests, like this: stage3/bin/zig test ../lib/std/std.zig This happened because the zig lib dir was inferred to be an absolute directory based on the zig executable directory, while the root source file was detected as a relative path. There was no common prefix and so it was not determined that the std.zig file was inside the lib directory. This commit adds a function for resolving paths that preserves relative path names while allowing absolute paths, and converting relative upwards paths (e.g. "../foo") to absolute paths. This restores the previous functionality while remaining compatible with systems such as WASI that cannot deal with absolute paths.
2022-11-27Use a slice for InstMap instead of std.HashMapJimmi Holst Christensen
The `sema.inst_map` datastructure is very often accessed. All instructions that reference the result of other instructions does a lookup into this field. Because of this, a significant amount of time, is spent in `std.HashMap.get`. This commit replaces the `HashMap` with a simpler data structure that uses the zir indexes to index into a slice for the result. See the data structure doc comment for more info.
2022-11-23Sema: implement tuple declarationsVeikka Tuominen
2022-11-23AstGen: implement tuple declarationsVeikka Tuominen
2022-11-20Module: fix compile error for non-comptime-known global initializerVeikka Tuominen
2022-11-20Module: fix `fieldSrcLoc` for generated typesVeikka Tuominen
2022-11-16Module: call `ensureDeclAnalyzed` on `builtin.test_functions`Veikka Tuominen
Previously the compiler would crash on branching on undefined values if you tried using `zig test` with a freestanding target since there was no start code referencing `builtin.test_functions`. Closes #12554
2022-11-13Sema: remove `block` and `src` parameters from `getBuiltin`Veikka Tuominen
These parameters are only ever needed when `std.builtin` is out of sync with the compiler in which case panicking is the only valid operation anyways. Removing them causes a domino effect of functions no longer needing a `src` and/or a `block` parameter resulting in handling compilation errors where they are actually meaningful becoming simpler.
2022-11-04Sema: make `InferredErrorSet` deterministicJacob Young
Empirically, this `AutoHashMapUnmanaged` -> `AutoArrayHashMapUnmanaged` change fixes all non-determinism in `ReleaseFast` build artifacts. Closes #12183
2022-10-30re-apply "Fix C include files not being in `whole` cache (#11365)"Andrew Kelley
This reverts commit 06310e3d4eb47fed88b175891cb5865bb050f020, reapplying commit a430630002bf02162ccbf8d3eb10fd73e490cefd. I deeply apologize to @moosichu and those affected by this bug. The original fix was actually fine. When I reverted it, I misremembered how the Cache API works. I thought the fix was going to introduce nondeterminism into the hash, but I forgot that the order of files in the manifest doesn't actually matter when checking for a cache hit. Actually, it does matter a little bit. This fix has a subtle downside which is that it does introduce the possibility of false negatives when checking for cache hits of 2+ iterations ago. For example, if the code goes from "foo", to "bar", and then back to "foo", it may look like a cache miss when it should have been a hit because 2 iterations ago the code was the same. However, this is an uncommon use case, and all it does is cause a bit of wasted time and disk space. That said, my suggestion from earlier still applies and would be a nice follow-up enhancement to this fix: The proper solution to this is to, in whole cache mode, append the hash inputs to some data structure, and then after the compilation is complete, do some kind of sorting on the hash inputs so that they will be the same order every time, then apply them in sequence. No lock on the Cache object is needed for this scheme. closes #11063