| Age | Commit message (Collapse) | Author |
|
|
|
Replaces occurences of @fabs absCast and absInt with new @abs builtin.
Also removes the std.math.fabs alias from math.zig.
|
|
Currently, the compiler (like @typeName) writes it `fn(...) Type` but
zig fmt writes it `fn (...) Type` (notice the space after `fn`).
This inconsistency is now resolved and function types are consistently
written the zig fmt way. Before this there were more `fn (...) Type`
occurrences than `fn(...) Type` already.
|
|
There are a couple concepts here worth understanding:
Key.UnionType - This type is available *before* resolving the union's
fields. The enum tag type, number of fields, and field names, field
types, and field alignments are not available with this.
InternPool.UnionType - This one can be obtained from the above type with
`InternPool.loadUnionType` which asserts that the union's enum tag type
has been resolved. This one has all the information available.
Additionally:
* ZIR: Turn an unused bit into `any_aligned_fields` flag to help
semantic analysis know whether a union has explicit alignment on any
fields (usually not).
* Sema: delete `resolveTypeRequiresComptime` which had the same type
signature and near-duplicate logic to `typeRequiresComptime`.
- Make opaque types not report comptime-only (this was inconsistent
between the two implementations of this function).
* Implement accepted proposal #12556 which is a breaking change.
|
|
fixes #10731
Thanks @nektro for previous work in #14878
This change creates a small breaking change:
It removes the `is_pub` field of a decl in `@typeInfo`
|
|
|
|
This is not used by Zig itself anywhere and not using the function is more idiomatic.
|
|
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:
* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
|
|
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
|
|
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
|
|
Followup to 902df103c6151c257c90de9ba5f29f7f4b9dbea2.
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
|
|
Followup to d42d31f72f38165f70c2850e9cc63da44b3b470c.
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
|
|
|
|
any comptime parameter sets `.is_generic` to be true but in many cases these will still be discrete types available in `.params`
|
|
not used by Zig itself anywhere
|
|
This was preventing `std.json` from deserializing non-exhaustive enums.
|
|
Tests that only reference decls for the purpose of analyzing more tests
should be unnamed, otherwise trying to filter for just a referenced test
can become impossible depending on the names.
|
|
Resolves: #7056
|
|
|
|
assumeSentinel was removed and replaced with a compileError, but it's
not pub, so the error message indicates it's private rather than
providing the compileError message.
|
|
All but 3 callsites of this function in the standard library and
compiler were unnecessary and were removed in faf2fd18.
In this commit, the remaining 3 callsites are removed. One of them
turned out to also be unnecessary and has been replaced by slicing
directly with the length..
The 2 remaining callsites were in the very pointer-math heavy
std/os/linux/vdso.zig code which should perhaps be refactored to better
utilize slices. These 2 callsites are replaced with a plain
@ptrCast([*:0]u8, ptr) though could likely use std.mem.sliceTo() if the
surrounding code was refactored.
|
|
This is simply a small convenience wrapper around
'meta.fieldInfo(T, .field).type'. However, this operation is common
enough that it makes sense to have its own function for.
|
|
Also:
* Use KeyPair.create() function
* Don't bother with CCM
|
|
|
|
|
|
This was a poor naming choice; these are parameters, not arguments.
Parameters specify what kind of arguments are expected, whereas the arguments are the actual values passed.
|
|
It's the type of a parameter, not an argument, but the prefix is redundant either way.
|
|
|
|
096d3efae5fcaa5640f4acb2f9be2d7f93f7fdb2 was not the cause of the
CI failure.
|
|
This reverts commit 096d3efae5fcaa5640f4acb2f9be2d7f93f7fdb2.
This commit is not passing a very important CI test that was recently
added.
|
|
This is now possible due to #13627.
|
|
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.
|
|
Empty structs would previously result in a compilation error.
|
|
Improve some error messages
|
|
|
|
Closes #12042
|
|
|
|
|
|
field indices
|
|
Closes #12881
|
|
Adds error for taking a non comptime parameter in a function returning a
comptime-only type but not when that type is dependent on a parameter.
Co-authored-by: Veikka Tuominen <git@vexu.eu>
|
|
|
|
of generating one per invocation.
|
|
|
|
Previously, TrailerFlags was unreferenced in std,
so its tests were never run.
Also, fix the use of `default_value` whose type was changed in
f4a249325e8e3741a6294462ae37a79cb9089c56 (#10766).
|
|
|
|
This function was one of the biggest zig functions in a debug build of
the compiler.
$ bloaty stage3-debug/bin/zig -d symbols --tsv -n 10000000 |
rg -v '(llvm|clang|std|lld|\(anonymous namespace\))::|\[section ' |
sort -h -k 3
...
translate_c.ast.renderNode 86168 86219
main.buildOutputType 177959 178004
InfoTable 184832 184870
AArch64SVEIntrinsicMap 188544 188596
print_targets.cmdTargets__anon_4735 319156 319216
__static_initialization_and_destruction_0() 486666 489582
MatchTable1 621884 621997
OperandMatchTable 1139622 1139861
MatchTable0 1899764 1900141
|
|
The unit tests of std.meta depended on `@typeInfo` for the same type
returning a slice of declarations and fields with the same pointer
address. This is not something guaranteed by the language specification.
|
|
* std.meta: correct use of `default_value` in reification. stage1
accepted a wrong type for `null`.
* Sema: after instantiating a generic function, if the return type ends
up being a comptime-known type, then we return an error, undoing the
generic function instantiation, and making a comptime function call
instead.
- We also needed to clean up the dependency graph in this case.
* Sema: reified enums set tag_ty_inferred to false since an integer tag
type is provided. This is a limitation of the `@Type` builtin which
will be addressed with #10710.
* Sema: fix resolveInferredErrorSet incorrectly calling
ensureFuncBodyAnalyzed on generic functions.
|
|
|