contains on a list of literals with an f"…" argument lowers to Rust that rustc refusesOpen and answer this issue on GitHub.
bug, ready · opened 2026-11-28 · updated 2026-11-28 · 0 comments
Found while “A combinator over io::lines() walks views, not a copy per line” (#2881), builder’s report, on HEAD d25729e4.
fn main() throws {
let x = "b"
println(["a", "b"].contains(f"{x}"))
}
This should print true, and the checker accepts it. The lowering writes .contains(&format!(...)), which rustc refuses (NK1343 “mismatched types”: expected &str, found Text). Written as let s: String = f"{x}" and then .contains(s), it works. The cause is not known yet; the suspect is the emitter’s argument of a contains on a list of literals (emit_core_calls.nika).
f"…" argument to contains on a list of string literals in the form the list’s element takes, as it does for a String local. Fixed in the .nika emitter, then lower-std.tests/compiler/tests/ with .stdout: the probe prints true, and with f"{x}x" it prints false.The probe prints true, the test passes, and the commit carries Fixes #N.
The emitter’s .nika files and their lowered output, the test. No new Rust.
Facts: Lowering and lower-std