Skip to content

Commit 1511488

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 08efb24 commit 1511488

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
@@ -10668,6 +10668,7 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op
1066810668
const tags = sema.code.instructions.items(.tag);
1066910669
for (body) |inst| {
1067010670
switch (tags[inst]) {
10671+
.save_err_ret_index,
1067110672
.dbg_block_begin,
1067210673
.dbg_block_end,
1067310674
.dbg_stmt,
@@ -10690,6 +10691,10 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op
1069010691
try sema.zirDbgStmt(block, inst);
1069110692
continue;
1069210693
},
10694+
.save_err_ret_index => {
10695+
try sema.zirSaveErrRetIndex(block, inst);
10696+
continue;
10697+
},
1069310698
.str => try sema.zirStr(block, inst),
1069410699
.as_node => try sema.zirAsNode(block, inst),
1069510700
.field_val => try sema.zirFieldVal(block, inst),

0 commit comments

Comments
 (0)