Open and answer this issue on GitHub.
selfhosting, compiler, ready · opened 2026-10-12 · updated 2026-11-03 · 1 comment
The self-hosting runs (#125) found lowering defects: the checker accepts a program and rustc refuses the lowered Rust (or the lowering writes something clippy refuses). That is a compiler defect (Part III C.1; ADR-294 D3: fixed in the compiler, not bent around in a .nika). docs/lowering-defects.md holds 19 entries, each with a probe, the expected and the actual result, and the workaround; 13 were reproduced on 2026-10-11.
From docs/lowering-defects.md: D1 a by-value read-only parameter lowers as &T and p with {..} writes ..p; D2 m.get(k)?.clone() ?? d on a map clones a reference; D3 set.insert(..) as the last call of a match arm / if is bool against (); D4 a for over Vec[Symbol] binds ref Symbol (checker-side); D7 x.len() as i64 writes a doubled cast (clippy); D8 a cast inside a map read lowers as &x as i64; D10 x ?? 0 over an Integer? lowers to a plain integer; D11/D11b a typed throw in a trait impl is not boxed / a thrown struct without impl Error reaches rustc; D14 a Copy value bound in a match inside a guard arrives as &T (same family as #578); D15 BTreeMap[Symbol, V] passes the checker and fails in rustc; D16 a match as a guard needs brackets; D17-D19 three more accepted by the checker and refused by rustc.
New since, not yet in that file (add them): println!(..) passes the checker and fails in rustc; xs.iter().filter fn(x) { x % 2 == 0 } fails rustc (&&i64); a Nikaia method named expect resolves to Option::expect, so a callback passed through it lowers as Kept<dyn Fn> instead of impl Fn; fn(ref String, ref String) -> ref String passes the checker and fails rustc (E0106; may be closed by #580, re-check).
.nika that the checker accepts, lowered and compiled with rustc, run) that fails today; collect them in crates/nikaia/tests/ (one file per family).python3 scripts/bump.py new).tools/*.nika and the entries from docs/lowering-defects.md as they land.Fixes #<this issue>.Related: #578, #573.
Generated by Claude Code
D15 is built (0.0.850, #589): BTreeMap/BTreeSet over a key with no order is refused with NK1247, the ledger has an orders column, Symbol is Ord (winnow-grammar b27d8ba). Its sibling, a HashMap/HashSet key that cannot be hashed (float, declared struct), is the same kind of defect and is filed as #591.
Generated by Claude Code