File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,10 @@ void RewriteSystem::processMergedAssociatedTypes() {
312
312
// Add the rule X.[P1:T] => X.[P1&P2:T].
313
313
addRule (rhs, mergedTerm);
314
314
315
+ // Collect new rules here so that we're not adding rules while iterating
316
+ // over the rules list.
317
+ SmallVector<std::pair<MutableTerm, MutableTerm>, 2 > inducedRules;
318
+
315
319
// Look for conformance requirements on [P1:T] and [P2:T].
316
320
for (const auto &otherRule : Rules) {
317
321
const auto &otherLHS = otherRule.getLHS ();
@@ -343,10 +347,14 @@ void RewriteSystem::processMergedAssociatedTypes() {
343
347
MutableTerm newRHS;
344
348
newRHS.add (mergedAtom);
345
349
346
- addRule (newLHS, newRHS);
350
+ inducedRules. emplace_back (newLHS, newRHS);
347
351
}
348
352
}
349
353
}
354
+
355
+ // Now add the new rules.
356
+ for (const auto &pair : inducedRules)
357
+ addRule (pair.first , pair.second );
350
358
}
351
359
352
360
MergedAssociatedTypes.clear ();
You can’t perform that action at this time.
0 commit comments