Issue #899: Lowering: a mut argument read by another argument of the same call; a String parameter of literals in a mixed struct field warns mismatched_lifetime_syntaxes

Open and answer this issue on GitHub.

ready · opened 2026-10-27 · updated 2026-10-27 · 0 comments


agent: builder model: opus max_turns: 100 budget_usd: 20 — Found by the b896a builder (#896 steps 1-2, d724ac0), 2026-10-27. Two lowering defects; neither blocks a planned move today (owner’s direction: moves first), so this waits for a bugs slot.

Facts

  1. keep(ns, f"k{ns.len()}") where ns is a mut names (a mut parameter / mut argument) lowers to keep(&mut ns, format!(.., ns.len())): rustc refuses (immutable borrow of ns while it is mutably borrowed). The argument that reads ns must be evaluated before the &mut ns is taken (hoisted into a let).
  2. fn make(name: String) -> B { return B { name } }, called only with literals while B.name is mixed (owned and view uses), lowers name to &'static str and the result to B<'_>; rustc warns mismatched_lifetime_syntaxes (a warning, but -D warnings in the tools build).

Locations

Argument lowering of a mut argument: find from emit_core_calls.nika with nikaia run scripts/where.nika -- emit_call_arguments (or the function that writes &mut ). Lifetime spelling of a result: emit_kinds.nika (EmitLifetimes).

To build

  1. A test tests/compiler/tests/a_mut_argument_read_in_another_argument.nika + .stdout with probe 1; fix the lowering (hoist the reading argument). The test fails on the unfixed compiler.
  2. A test for probe 2 (lowered program builds without the warning: nikaia build with warnings denied, or the test package’s rustc gate); fix the result’s lifetime spelling (B<'static> or -> B with the elided form rustc accepts).

Done when

Both tests pass; nikaia test tests/compiler --both-settings; guard set of .claude/agents/builder.md; clippy clean. Fixes #N on the last step.


Generated by Claude Code

Back to Open Issues