Result: done
Tests: tests/compiler (–both-settings) all ok except the dropped third probe; new: a_let_mut_of_a_list_element_is_a_view_of_it, a_let_mut_of_a_struct_of_numbers_in_a_list_is_not_a_copy, a_let_mut_of_a_list_element_ends_with_its_last_use (the last run by hand after the full run); it: selfhosting_defects + guard set 42 ok; clippy clean
Deviation: third test is the rustc-clean variant (v read after e’s last use); the issue’s variant (v read between the let and the write) is not a checker refusal: rustc fails (“Cannot borrow v as immutable because it is also borrowed as mutable”, no NK code), a Part I 6.8 gap. The new tests were not run against an unfixed compiler by stash (shared tree); the probes failed on the unfixed binary as the issue says (p2 lowered to *get(&v, 0)). The field case (let mut f = s.field) is not built: only the list element.
Found: let mut e = v[0] then a read of v before the last use of e reaches rustc (E0502 mapped, no NK code); needs a checker refusal (view_changes.nika, with #960’s NK2305 family); probe: struct P{pub n:i64}; let mut v: Vec[P]=[..]; let mut e = v[0]; println(f”{v[1].n}”); e.n = 10
Needs: owner decision on the NK code for a read of a list while a mutable view of its element lives
Changelog: let mut e = v[i] over a mut list binds &mut v[i], a view of the element, also for a struct of numbers (#959)
Gate: green
Files: crates/nikaia-std/src/tools/check_core_stmt.nika crates/nikaia-std/src/tools/emit_stmt.nika crates/nikaia-std/src/tools/lowered/check_core_stmt.rs crates/nikaia-std/src/tools/lowered/emit_stmt.rs