Issue #1149: Grammar lowering: a choice whose alternatives yield different values, unbound, fails in rustc

Open and answer this issue on GitHub.

ready · opened 2026-11-02 · updated 2026-11-02 · 0 comments

Found by the b34 builder (same_line, 233786b3). The defect was there before that change and is separate from same_line.

An unbound choice whose alternatives yield different output types is lowered to an alt that needs one output type. rustc then rejects it, over text and Bytes alike.

Probe:

grammar Q {
    entry rule t -> String = "x" eof -> { "x" }
    rule WS = (multispace1 | "//" until(line_ending))* -> { }
}

Q::t("x") → rustc: Expected ... to return Result<(&str, &str), ...>, but it returns Result<&str, ...>.

To build

  1. Lower each alternative of such a choice so they all yield one type (e.g. map to () where the value is unbound), or have the checker refuse it with a clear error.
  2. Add a tests/compiler program built from the probe.

Back to Open Issues