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() {
312312 // Add the rule X.[P1:T] => X.[P1&P2:T].
313313 addRule (rhs, mergedTerm);
314314
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+
315319 // Look for conformance requirements on [P1:T] and [P2:T].
316320 for (const auto &otherRule : Rules) {
317321 const auto &otherLHS = otherRule.getLHS ();
@@ -343,10 +347,14 @@ void RewriteSystem::processMergedAssociatedTypes() {
343347 MutableTerm newRHS;
344348 newRHS.add (mergedAtom);
345349
346- addRule (newLHS, newRHS);
350+ inducedRules. emplace_back (newLHS, newRHS);
347351 }
348352 }
349353 }
354+
355+ // Now add the new rules.
356+ for (const auto &pair : inducedRules)
357+ addRule (pair.first , pair.second );
350358 }
351359
352360 MergedAssociatedTypes.clear ();
You can’t perform that action at this time.
0 commit comments