Skip to content

Commit 675169d

Browse files
committed
Update pattern-matching for error unwrapping
The new .save_err_ret_index that can be at the front of a block can surprise the `catch unreachable` pattern matcher.
1 parent 5517007 commit 675169d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Sema.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10652,6 +10652,7 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op
1065210652
const tags = sema.code.instructions.items(.tag);
1065310653
for (body) |inst| {
1065410654
switch (tags[inst]) {
10655+
.save_err_ret_index,
1065510656
.dbg_block_begin,
1065610657
.dbg_block_end,
1065710658
.dbg_stmt,
@@ -10674,6 +10675,10 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op
1067410675
try sema.zirDbgStmt(block, inst);
1067510676
continue;
1067610677
},
10678+
.save_err_ret_index => {
10679+
try sema.zirSaveErrRetIndex(block, inst);
10680+
continue;
10681+
},
1067710682
.str => try sema.zirStr(block, inst),
1067810683
.as_node => try sema.zirAsNode(block, inst),
1067910684
.field_val => try sema.zirFieldVal(block, inst),

0 commit comments

Comments
 (0)