Skip to content

Commit 6e6c8c2

Browse files
committed
RequirementMachine: Only check local rules against maximum rule limit
Completion has a maximum rule limit since the Knuth-Bendix algorithm is a semi-decision procedure that does not terminate on all inputs. However, this means that generic signatures which import a large number of complex protocols can hit the limit even if they are convergent. Since imported rules are essentially free, ignore them here, to avoid having to increase the limit by hand. Now the default limit is 4000 local rules per requirement machine; it seems implausible that you would exceed this, but if anyone has an example we can bump the limit again.
1 parent 6095065 commit 6e6c8c2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/AST/RequirementMachine/KnuthBendix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ RewriteSystem::computeConfluentCompletion(unsigned maxRuleCount,
391391

392392
for (const auto &pair : resolvedCriticalPairs) {
393393
// Check if we've already done too much work.
394-
if (Rules.size() > maxRuleCount)
394+
if (getLocalRules().size() > maxRuleCount)
395395
return std::make_pair(CompletionResult::MaxRuleCount, Rules.size() - 1);
396396

397397
if (!addRule(pair.LHS, pair.RHS, &pair.Path))

lib/AST/RequirementMachine/RequirementMachine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ RequirementMachine::computeCompletion(RewriteSystem::ValidityPolicy policy) {
305305
}
306306
}
307307

308-
if (System.getRules().size() > MaxRuleCount) {
308+
if (System.getLocalRules().size() > MaxRuleCount) {
309309
return std::make_pair(CompletionResult::MaxRuleCount,
310310
System.getRules().size() - 1);
311311
}

0 commit comments

Comments
 (0)