diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-02-13 17:09:21 -0500 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-02-15 03:45:21 -0500 |
| commit | 8159ff8b811a1621674b0f00a01b5a92698af8f9 (patch) | |
| tree | 273c5d568004ec6d40e0d35919ddf81533e54dcd /src/Sema.zig | |
| parent | 5ab5113077bf82237978168b32e2b549a4a71feb (diff) | |
| download | zig-8159ff8b811a1621674b0f00a01b5a92698af8f9.tar.gz zig-8159ff8b811a1621674b0f00a01b5a92698af8f9.zip | |
x86_64: implement error set and enum safety
This is all of the expected 0.14.0 progress on #21530, which can now be
postponed once this commit is merged.
This required rewriting the (un)wrap operations since the original
implementations were extremely buggy.
Also adds an easy way to retrigger Sema OPV bugs so that I don't have to
keep updating #22419 all the time.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 7ce2fefe1e..16765d1a89 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -8850,7 +8850,7 @@ fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError // Use `intCast`, since it'll set up the Sema-emitted safety checks for us! const int_val = try sema.intCast(block, src, int_tag_ty, src, operand, src, true, true); const result = try block.addBitCast(dest_ty, int_val); - if (zcu.backendSupportsFeature(.is_named_enum_value)) { + if (!dest_ty.isNonexhaustiveEnum(zcu) and zcu.backendSupportsFeature(.is_named_enum_value)) { const ok = try block.addUnOp(.is_named_enum_value, result); try sema.addSafetyCheck(block, src, ok, .invalid_enum_value); } |
