diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-11 22:34:03 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-13 02:38:13 -0400 |
| commit | 4a28c1d5c3627510cef97b88ee6b3988f65ac0dd (patch) | |
| tree | 17d331556c594b52a4f03c143bf2720dbc3afeca /src/Module.zig | |
| parent | 3708e26f4b8b9514f055ae2a0571d3290414bf8b (diff) | |
| download | zig-4a28c1d5c3627510cef97b88ee6b3988f65ac0dd.tar.gz zig-4a28c1d5c3627510cef97b88ee6b3988f65ac0dd.zip | |
stage2: lower each struct field type, align, init separately
Previously, struct types, alignment values, and initialization
expressions were all lowered into the same ZIR body, which caused false
positive "depends on itself" errors when the initialization expression
depended on the size of the struct.
This also uses ResultLoc.coerced_ty for struct field alignment and
initialization values. The resulting ZIR encoding ends up being roughly
the same, neither smaller nor larger than previously.
Closes #12029
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Module.zig b/src/Module.zig index f9cfc5e54e..67fc0ca619 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -916,13 +916,14 @@ pub const Struct = struct { /// one possible value. known_non_opv: bool, requires_comptime: PropertyBoolean = .unknown, + have_field_inits: bool = false, pub const Fields = std.StringArrayHashMapUnmanaged(Field); /// The `Type` and `Value` memory is owned by the arena of the Struct's owner_decl. pub const Field = struct { /// Uses `noreturn` to indicate `anytype`. - /// undefined until `status` is `have_field_types` or `have_layout`. + /// undefined until `status` is >= `have_field_types`. ty: Type, /// Uses `unreachable_value` to indicate no default. default_val: Value, |
