Issue #1004: Grammar entry on a temporary Bytes(..) with a text result: rustc “temporary value dropped while borrowed”

Open and answer this issue on GitHub.

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

Found by the yaml lane (y1-tree-core, #928).

G::w(Bytes([97, 97])) catch { return }

with a rule whose result is text (a view into the input) fails in rustc with temporary value dropped while borrowed. let input = Bytes([97, 97]) first, then G::w(input), works. The compiler should keep the temporary (ADR-353 D8-D10 keep) or refuse with an NK error naming the fix; it must not reach rustc.

To build

  1. The lowering binds the temporary argument to a local before the call when the result borrows from it (or the checker refuses).
  2. A test in tests/compiler/tests/grammar_*.nika.

Back to Open Issues