0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std/zig
mlugg d11bbde5f9
compiler: remove anonymous struct types, unify all tuples
This commit reworks how anonymous struct literals and tuples work.

Previously, an untyped anonymous struct literal
(e.g. `const x = .{ .a = 123 }`) was given an "anonymous struct type",
which is a special kind of struct which coerces using structural
equivalence. This mechanism was a holdover from before we used
RLS / result types as the primary mechanism of type inference. This
commit changes the language so that the type assigned here is a "normal"
struct type. It uses a form of equivalence based on the AST node and the
type's structure, much like a reified (`@Type`) type.

Additionally, tuples have been simplified. The distinction between
"simple" and "complex" tuple types is eliminated. All tuples, even those
explicitly declared using `struct { ... }` syntax, use structural
equivalence, and do not undergo staged type resolution. Tuples are very
restricted: they cannot have non-`auto` layouts, cannot have aligned
fields, and cannot have default values with the exception of `comptime`
fields. Tuples currently do not have optimized layout, but this can be
changed in the future.

This change simplifies the language, and fixes some problematic
coercions through pointers which led to unintuitive behavior.

Resolves: #16865
History 2024-10-31 20:42:53 +00:00
..
system compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
Ast.zig std.zig.render: fix switch rendering 2024-09-01 18:30:31 +01:00
AstGen.zig compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
AstRlAnnotate.zig compiler: remove @setAlignStack 2024-10-19 19:15:23 +01:00
BuiltinFn.zig compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
c_builtins.zig std: update uses of .Inline callconv 2024-10-19 19:21:33 +01:00
c_translation.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
Client.zig build runner sends a start_fuzzing message to test runner 2024-07-25 18:52:21 -07:00
ErrorBundle.zig Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
LibCDirs.zig std.Target: Introduce Abi.ohoseabi to distinguish the soft float case. 2024-10-05 15:13:37 +02:00
LibCInstallation.zig link: fix false positive crtbegin/crtend detection 2024-10-10 14:21:52 -07:00
number_literal.zig Make 0e.0 and 0xp0 not crash 2024-07-03 02:53:37 -04:00
Parse.zig std.zig: resolve syntactic ambiguity 2024-09-01 18:30:31 +01:00
parser_test.zig std: update uses of .Inline callconv 2024-10-19 19:21:33 +01:00
perf_test.zig lib: correct unnecessary uses of 'var' 2023-11-19 09:55:07 +00:00
primitives.zig ComptimeStringMap: return a regular struct and optimize 2024-04-22 15:31:41 -07:00
render.zig std.zig.render: fix callconv(.Inline) -> inline fn promotion 2024-10-19 19:15:23 +01:00
Server.zig Merge pull request #21224 from alexrp/mips-gnu-fixes 2024-08-30 14:47:43 -07:00
string_literal.zig std.zig.tokenizer: simplify 2024-07-31 16:57:42 -07:00
system.zig std.Target: Change Cpu.baseline() to also be able to take OS into consideration. 2024-10-16 00:33:10 +02:00
target.zig std.Target: Move isLib{C,Cxx}LibName() to std.zig.target. 2024-10-16 22:25:13 +02:00
tokenizer.zig tokenizer: fix 0 byte following invalid (#21482) 2024-09-23 13:06:30 -07:00
WindowsSdk.zig Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
Zir.zig compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00