diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-16 15:46:43 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-20 20:25:11 +0200 |
| commit | e5a3eb9777ff165d936b0811f3825eabb8bcd6a4 (patch) | |
| tree | 15b67ec852dc6b41d1b54a1039bcdd6581aa0449 /src/Sema.zig | |
| parent | 44f8714dfb69fac2e8c7a6a35ad9f2abe7c4513a (diff) | |
| download | zig-e5a3eb9777ff165d936b0811f3825eabb8bcd6a4.tar.gz zig-e5a3eb9777ff165d936b0811f3825eabb8bcd6a4.zip | |
Type: make `hasRuntimeBitsAdvanced` take `AbiAlignmentAdvancedStrat`
I wasn't able to create a reduced test case for this but the reasoning
can be seen in `abiAlignmentAdvancedUnion` where if `strat` was lazy
`hasRuntimeBitsAdvanced` would be given `null` instead of `sema`
which would cause eager evaluation when it is not valid or desired.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index a6811d37fd..b3f1dd1bf0 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -128,7 +128,7 @@ pub const Block = struct { /// Shared among all child blocks. sema: *Sema, /// The namespace to use for lookups from this source block - /// When analyzing fields, this is different from src_decl.src_namepsace. + /// When analyzing fields, this is different from src_decl.src_namespace. namespace: *Namespace, /// The AIR instructions generated for this block. instructions: std.ArrayListUnmanaged(Air.Inst.Index), @@ -31298,7 +31298,10 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { } pub fn typeHasRuntimeBits(sema: *Sema, ty: Type) CompileError!bool { - return ty.hasRuntimeBitsAdvanced(false, sema); + return ty.hasRuntimeBitsAdvanced(false, .{ .sema = sema }) catch |err| switch (err) { + error.NeedLazy => unreachable, + else => |e| return e, + }; } fn typeAbiSize(sema: *Sema, ty: Type) !u64 { |
