Commit b6133931d0

Andrew Kelley <andrew@ziglang.org>
2022-03-31 21:25:48
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 parent cf4aad4
Changed files (1)
src/Sema.zig
@@ -21549,6 +21549,7 @@ fn resolveInferredErrorSet(
     var it = ies.inferred_error_sets.keyIterator();
     while (it.next()) |other_error_set_ptr| {
         const other_ies: *Module.Fn.InferredErrorSet = other_error_set_ptr.*;
+        if (ies == other_ies) continue;
         try sema.resolveInferredErrorSet(block, src, other_ies);
 
         for (other_ies.errors.keys()) |key| {