Issue #2975: ?? with a text literal after nth over a kept chain over lines fails in rustc (NK1343, &’static str into Text)

Open and answer this issue on GitHub.

bug, ready · opened 2026-11-30 · updated 2026-11-30 · 0 comments

Probe

use std::io

fn main() throws {
    let u = io::lines().filter(fn(l) { l.len() > 1 })
    println(f"{u.nth(1) ?? "none"}")
}

It should print the second long line, or none (Part I 4.5). It stops with NK1343: rustc reports mismatched types and suggests calling Into::into to convert &'static str into Text.

let x = u.nth(1) followed by x != null runs. It fails on b36e564a and on the binary from before run 6 of #2927 alike.

Suspected

The emitter writes nikaia_std::index::or(u.nth(1).await?, || "none") without the literal’s .into(), because the type of nth’s result is not a text that the fallback rule knows.

Check: lower the probe and read the or call.

To build

  1. Give the fallback the text conversion when the nth (or next) of a kept stream state yields text.
  2. Add a test in tests/compiler/tests/ with the probe above, with stdin both with and without a second long line, passing in both settings.

Done when

The probe prints the line or none in both settings, and the lines, stream and fallback test groups stay green.

Found in run 6 of “Chains over lists, maps and std’s other producers are one loop the compiler writes, and seq.rs leaves Rust (ADR-chain-loop-v1 D6, D7)” (#2927).

Back to Open Issues