Issue #1241: Checker: a use after a keep self call is refused only by rustc

Open and answer this issue on GitHub.

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

Defect

The checker does not refuse a use of a value after a keep self method consumed it, nor self.part.into_x() (a keep self method on a field) inside a ref self method. Only rustc refuses these, with its own message (“Use of moved value: b”), so nikaia check passes a program that nikaia run then refuses, and nikaia test counts it as a failed build, not a refusal.

Probe (nikaia check passes; should be refused with an NK code and a help):

struct Box { name: String }
impl Box {
    fn take(keep self) -> String { return self.name }
}
fn main() {
    let b = Box { name: "hi" }
    println(b.take())
    println(b.take())
}

To build

  1. The checker refuses a use after a keep self call (the existing use-after-move code, if one fits; else a new code from the supervisor), and a keep self call on a field of a lent self.
  2. Tests in tests/compiler/ with .stderr: both cases refused, and one call followed by no use still runs.

Part of #1213.


Generated by Claude Code

Back to Open Issues