authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-31 12:25:48-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-31 12:25:48-07:00
logb6133931d04afc6980dfff2e87dadc85922d5335
tree139869f6dee5fc8c4725c78ddc4780e56c46f059
parentcf4aad4858ac61b4814d8f021c8eae22ee7f63e6

Sema: fix segfault during resolveInferredErrorSet

There was a simple missing check of adding an inferred error set to itself, in which case we should not try to mutate the hash map while iterating over it.

1 files changed, 1 insertions(+), 0 deletions(-)

src/Sema.zig+1
...@@ -21549,6 +21549,7 @@ fn resolveInferredErrorSet(...@@ -21549,6 +21549,7 @@ fn resolveInferredErrorSet(
21549 var it = ies.inferred_error_sets.keyIterator();21549 var it = ies.inferred_error_sets.keyIterator();
21550 while (it.next()) |other_error_set_ptr| {21550 while (it.next()) |other_error_set_ptr| {
21551 const other_ies: *Module.Fn.InferredErrorSet = other_error_set_ptr.*;21551 const other_ies: *Module.Fn.InferredErrorSet = other_error_set_ptr.*;
21552 if (ies == other_ies) continue;
21552 try sema.resolveInferredErrorSet(block, src, other_ies);21553 try sema.resolveInferredErrorSet(block, src, other_ies);
2155321554
21554 for (other_ies.errors.keys()) |key| {21555 for (other_ies.errors.keys()) |key| {