You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vec.set_i32/set_i64 intrinsics bypass the receiver-mutability check that push and v[i] = x enforce #1007
Found 2026-09-03 while rewriting MirLower.w's legacy self.field.set_i32(i as i64, v) calls to self.field[i] = v (the least-ceremony rule). The rewrite produced 14 cannot assign through a read-only place (§15.10) errors, and fixing them honestly cascaded into 20 methods that had to become mut fn: clear_local_value_moved, cancel_scheduled_value_drop_for_local, remove_moved_field_entry, cancel_stmt_temp_for_local, remember_regex_pattern_captures, set_string_local_flags, set_string_field_path_flags, set_string_field_flags, mark_string_base_fields_may_alias, forget_string_flow_facts, clear_moved_fields_for_local, clear_moved_fields_for_place, set_string_local_may_alias, set_string_place_flags, transfer_string_field_facts_between_bases, update_string_aggregate_alias_after_assignment, mark_string_local_copied, set_string_place_may_alias, update_string_alias_after_assignment, mark_string_place_copied.
Every one of them was declared with a read-only fn receiver and mutated self through set_i32. The same body with push is rejected (method 'Vec.push' requires a mutable receiver), and with v[i] = x it is rejected (§15.10). So the intrinsic is a hole in the receiver contract: "the signature states parameter ownership mode — load-bearing" (CLAUDE.md, spec §3.8) is false for any fn that calls set_i32/set_i64.
set_i32/set_i64 obey the same receiver rule as element assignment (Sema.w syms.set_i32, SemaCheck.w:14284 groups it with push/clear but the read-only-receiver rejection does not fire). Better: retire the set_* intrinsics in favor of v[i] = x now that element assignment exists — 177 call sites in src/ and 2 in tools/, all rewritable mechanically (the uncast.w script from this batch already does .set_i32(E as i64, V) → [E] = V). The 20 MirLower methods are already mut fn on main after this batch.
Fixed on main: b9e0e65 — the compiler-modeled Vec.set_i32 intrinsic is retired from Sema/MirLower/CodegenDispatch/CCodegen (every use across src/, lib/std incl. subdirectories, rt, tools is element assignment), so the receiver contract is enforced by v[i] = x's own rule; the 73 read-only methods that mutated through the seam are mut fn since 2bb9a3f. Pin: test/compile_errors/err_read_receiver_element_assign.w. Battery green, reseeded at afab485.
Activity
Mir.w: drop-state dataflow over interned place keys (worklist fixpoin…
least-ceremony sweep (regenerated on d84a4437): str.byte_at(i) → s[i]…
Sema/MirLower/Codegen: retire the compiler-modeled Vec.set_i32 intrin…
tests: the two fixtures that called the retired Vec.set_i32 use eleme…
ehartford commentedon Sep 4, 2026
Fixed on main: b9e0e65 — the compiler-modeled Vec.set_i32 intrinsic is retired from Sema/MirLower/CodegenDispatch/CCodegen (every use across src/, lib/std incl. subdirectories, rt, tools is element assignment), so the receiver contract is enforced by
v[i] = x's own rule; the 73 read-only methods that mutated through the seam aremut fnsince 2bb9a3f. Pin: test/compile_errors/err_read_receiver_element_assign.w. Battery green, reseeded at afab485.