Given a set of rules that's been partitioned into two groups, move rules from the first partition to the second if there are higher-priority rules in the second group. In the final generated code, we'll check the rules in the first ("selected") group before any in the second ("deferred") group. But we need the result to be _as if_ we checked the rules in strict descending priority order. When eva
(rules: &RuleSet, order: &mut [usize], partition_point: usize)
| 158 | /// set, the returned partition-point is always less than or equal to the |
| 159 | /// initial partition-point. |
| 160 | fn respect_priority(rules: &RuleSet, order: &mut [usize], partition_point: usize) -> usize { |
| 161 | let (selected, deferred) = order.split_at_mut(partition_point); |
| 162 | |
| 163 | if let Some(max_deferred_prio) = deferred.iter().map(|&idx| rules.rules[idx].prio).max() { |
| 164 | partition_in_place(selected, |&idx| rules.rules[idx].prio >= max_deferred_prio) |
| 165 | } else { |
| 166 | // If the deferred set is empty, all selected rules are fine where |
| 167 | // they are. |
| 168 | partition_point |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | /// A query which can be tested against a [Rule] to see if that rule requires |
| 173 | /// the given kind of control flow around the given binding sites. These |
no test coverage detected