Issue #1222: An emit refusal with at: -1 panics in Span::new instead of showing the refusal

Open and answer this issue on GitHub.

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

crates/nikaia/src/emit/host.rs renders EmitRefused.at as at as usize. A refusal built with at: -1 (no position) therefore panics in Span::new with PosOverflow, and the user sees a compiler panic instead of the refusal’s message.

Found by a5b (async lowering, #988): its async refusals now pass null to avoid it, but every other refusal that has no position is exposed.

Probe: any emit refusal built with at: -1; before a5b’s change, an async form the lowering refused panicked in render_refusal.

To build

  1. host.rs treats a negative at as “no position” and renders the refusal without a source span (moving the rendering into Nikaia where that works directly, per CLAUDE.md).
  2. A test under tests/compiler/ with a refusal that has no position, showing the message instead of a panic.

Back to Open Issues