Compare two block-eligible `KConst`s with full structural ordering. Different kinds order by `kconst_kind_ord`; same-kind dispatch goes to the kind-specific comparator. `resolve_ctor` is invoked for each Indc-vs-Indc comparison to fetch the concrete `KConst::Ctor` referenced by a ctor `KId`. The kernel caller threads a closure that consults `KEnv::get`.
( x: &KConst<M>, y: &KConst<M>, ctx: &KMutCtx, resolve_ctor: &dyn Fn(&KId<M>) -> Option<KConst<M>>, )
| 456 | x: &KConst<M>, |
| 457 | y: &KConst<M>, |
| 458 | ctx: &KMutCtx, |
| 459 | resolve_ctor: &dyn Fn(&KId<M>) -> Option<KConst<M>>, |
| 460 | ) -> Result<SOrd, TcError<M>> { |
| 461 | match (x, y) { |
| 462 | ( |
| 463 | KConst::Defn { kind: xk, lvls: xl, ty: xt, val: xv, .. }, |
| 464 | KConst::Defn { kind: yk, lvls: yl, ty: yt, val: yv, .. }, |
| 465 | ) => compare_kdefn::<M>(*xk, *xl, xt, xv, *yk, *yl, yt, yv, ctx), |
| 466 | ( |
| 467 | KConst::Indc { |
| 468 | lvls: xl, |
| 469 | params: xp, |
| 470 | indices: xi, |
| 471 | is_unsafe: xu, |
| 472 | ty: xt, |
| 473 | ctors: xc, |
| 474 | .. |
| 475 | }, |
| 476 | KConst::Indc { |
| 477 | lvls: yl, |
| 478 | params: yp, |
| 479 | indices: yi, |
| 480 | is_unsafe: yu, |
| 481 | ty: yt, |
| 482 | ctors: yc, |
| 483 | .. |
| 484 | }, |
| 485 | ) => compare_kindc::<M>( |
| 486 | *xl, |
| 487 | *xp, |
| 488 | *xi, |
| 489 | *xu, |
| 490 | xt, |
| 491 | xc, |
| 492 | *yl, |
| 493 | *yp, |
| 494 | *yi, |
| 495 | *yu, |
| 496 | yt, |
| 497 | yc, |
| 498 | ctx, |
| 499 | resolve_ctor, |
| 500 | ), |
| 501 | ( |
| 502 | KConst::Recr { |
| 503 | lvls: xl, |
| 504 | params: xp, |
| 505 | indices: xi, |
| 506 | motives: xm, |
| 507 | minors: xn, |
| 508 | k: xk, |
| 509 | ty: xt, |
| 510 | rules: xr, |
| 511 | .. |
| 512 | }, |
| 513 | KConst::Recr { |
| 514 | lvls: yl, |
| 515 | params: yp, |