Subsumption (Phase 2)
(xs: &[VarNode], ys: &[VarNode])
| 504 | } |
| 505 | } else { |
| 506 | // All UnivData variants for `b` are covered above. |
| 507 | unreachable!( |
| 508 | "normalize_imax_dispatch: all UnivData variants for b should be covered" |
| 509 | ); |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | // Subsumption (Phase 2) |
| 514 | fn subsume_vars(xs: &[VarNode], ys: &[VarNode]) -> Vec<VarNode> { |
| 515 | let mut result = Vec::new(); |
| 516 | let mut xi = 0; |
| 517 | let mut yi = 0; |
| 518 | while xi < xs.len() { |
| 519 | if yi >= ys.len() { |
| 520 | result.extend_from_slice(&xs[xi..]); |
| 521 | break; |
| 522 | } |
| 523 | match xs[xi].idx.cmp(&ys[yi].idx) { |
| 524 | std::cmp::Ordering::Less => { |
| 525 | result.push(xs[xi].clone()); |
| 526 | xi += 1; |
| 527 | }, |
| 528 | std::cmp::Ordering::Equal => { |
| 529 | if xs[xi].offset > ys[yi].offset { |
| 530 | result.push(xs[xi].clone()); |
| 531 | } |
| 532 | xi += 1; |
| 533 | yi += 1; |
| 534 | }, |
| 535 | std::cmp::Ordering::Greater => { |
| 536 | yi += 1; |
no test coverage detected