diff options
| author | Veikka Tuominen <git@vexu.eu> | 2024-01-29 11:57:29 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2024-01-29 13:48:45 +0200 |
| commit | f7822029100de9f91c9a7758ffb32d95f7768f70 (patch) | |
| tree | 551ee2c7a6600facd02e27c62650483f89ba0986 /src/Sema.zig | |
| parent | abb8e7478d365088301a9390c12f86b2ad381ce9 (diff) | |
| download | zig-f7822029100de9f91c9a7758ffb32d95f7768f70.tar.gz zig-f7822029100de9f91c9a7758ffb32d95f7768f70.zip | |
Sema: do not emit `@errorCast` safety check when dest is adhoc inferred error set
Closes #17354
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 5 |
1 files changed, 4 insertions, 1 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); |
