diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-01-29 13:07:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-29 13:07:37 -0800 |
| commit | f4f8036ec048daa072c7caa72edd320c85bf426c (patch) | |
| tree | b0ab4a567d57e1d562c950c98e810b420ea4f723 /src | |
| parent | 3e939e61538706f37abb76a97af0ee77c15b24fc (diff) | |
| parent | 78e982f7c3e8a441259d26a69690d8934dd32bf0 (diff) | |
| download | zig-f4f8036ec048daa072c7caa72edd320c85bf426c.tar.gz zig-f4f8036ec048daa072c7caa72edd320c85bf426c.zip | |
Merge pull request #18729 from Vexu/fixes
Fix some generic{Reader,Writer} related issues
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 5 | ||||
| -rw-r--r-- | src/codegen/llvm.zig | 4 | ||||
| -rw-r--r-- | src/value.zig | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index af3e3700d7..2c404c476e 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -22368,7 +22368,10 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData try sema.requireRuntimeBlock(block, src, operand_src); const err_int_ty = try mod.errorIntType(); - if (block.wantSafety() and !dest_ty.isAnyError(mod) and sema.mod.backendSupportsFeature(.error_set_has_value)) { + if (block.wantSafety() and !dest_ty.isAnyError(mod) and + dest_ty.toIntern() != .adhoc_inferred_error_set_type and + sema.mod.backendSupportsFeature(.error_set_has_value)) + { if (dest_tag == .ErrorUnion) { const err_code = try sema.analyzeErrUnionCode(block, operand_src, operand); const err_int = try block.addBitCast(err_int_ty, err_code); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index f01c27042b..5cbcf6b3d6 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -8694,10 +8694,10 @@ pub const FuncGen = struct { if (!result_is_ref) { return self.dg.todo("implement bitcast vector to non-ref array", .{}); } - const array_ptr = try self.buildAllocaWorkaround(inst_ty, .default); + const alignment = inst_ty.abiAlignment(mod).toLlvm(); + const array_ptr = try self.buildAllocaWorkaround(inst_ty, alignment); const bitcast_ok = elem_ty.bitSize(mod) == elem_ty.abiSize(mod) * 8; if (bitcast_ok) { - const alignment = inst_ty.abiAlignment(mod).toLlvm(); _ = try self.wip.store(.normal, operand, array_ptr, alignment); } else { // If the ABI size of the element type is not evenly divisible by size in bits; diff --git a/src/value.zig b/src/value.zig index 1de0f66717..69ddb56b8f 100644 --- a/src/value.zig +++ b/src/value.zig @@ -1550,6 +1550,8 @@ pub const Value = struct { }, .ptr => |ptr| switch (ptr.addr) { .eu_payload, .opt_payload => |base| Value.fromInterned(base).canMutateComptimeVarState(mod), + .anon_decl => |anon_decl| Value.fromInterned(anon_decl.val).canMutateComptimeVarState(mod), + .elem, .field => |base_index| Value.fromInterned(base_index.base).canMutateComptimeVarState(mod), else => false, }, .opt => |opt| switch (opt.val) { |
