Issue #1326: lower-std: a sync function in tools/ that calls an async one passes the check and fails in rustc

Open and answer this issue on GitHub.

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

Found (while building #1285): in package mode, lower-std accepts a sync function in crates/nikaia-std/src/tools/ that calls a function inferred as async. The lowered Rust then writes .await inside a non-async fn, and rustc rejects it. The check should catch this, as it does for programs (NK2202 family).

Probe: in a tools/*.nika, write fn a() -> i64 { ...something that pauses... } (no sync, so it is inferred async), and pub fn b() -> i64 sync { a() }. Run nikaia lower-std: it passes, and cargo build fails on the .await in b.

To build

  1. The package-mode check in tools/check_* refuses a sync function that calls an async one, with the same code and message as a program gets.
  2. Add a test under tests/compiler/ with the expected .stderr.

Done when the probe fails at lower-std, not at rustc.


Generated by Claude Code

Back to Open Issues