spawn fn { f(s) } where f throws and calls process::runOpen and answer this issue on GitHub.
compiler, ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments
Problem. A bogus warning Unused import: ProbePlain (a name the program never wrote) is printed for spawn fn { work(s) } where work throws and calls process::run. The program runs correctly. Found by the supervisor’s script builders (2026-10-31). spawn is to be removed by #991 (async, ADR-async-1..4); if #991 lands first, check whether async fn { work(s) } shows the same warning, and close this if not.
Probe (0.0.1322):
use std::process
fn work(s: String) -> bool throws {
let out = process::run("true", [s])
return out.code == 0
}
fn main() throws {
let s = f"a{1}"
let h = spawn fn { work(s) }
println(f"{h.join()}")
}
nikaia run prints warning: Unused import: ProbePlain. at line 10, then true. Expected: no warning.
Suspected location (low confidence): the lowering of a spawn lambda emits a use ...::ProbePlain (the throws-probe of a task’s error) that the lambda’s body does not need, and the warning from rustc is mapped back to the source; the import should be written only where it is used.
To build
tests/compiler/tests/spawn_throwing_process_no_warning.nika + .stdout (true), and the .stderr empty.Generated by Claude Code