Issue #1114: A text literal where an fs::Path? is asked: a struct field passes check and fails in rustc, a typed let is refused NK1103

Open and answer this issue on GitHub.

ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments

Found by the builder moving crates/nikaia/src/proofs.rs (Place), probed by the architect on target/fast/nikaia at b45fbcc8.

What happens. Text stands wherever an fs::Path is asked (ADR-319 D2). A text literal in a struct field of type fs::Path is lowered std::path::PathBuf::from("b.nika") and runs; in a field of type fs::Path? it passes nikaia check and is lowered Some("a.nika"), which rustc refuses (Mismatched types). The same literal in let p: fs::Path? = "c.nika" is refused NK1103 (This value is `ref String`, but the `let` declares `fs::Path?`), while let p: fs::Path = "c.nika" runs: the three places disagree.

Probe (nikaia run p.nika; wanted 3 4 false):

use std::fs
struct Where { file: fs::Path?, line: i64 }
struct Here { file: fs::Path, line: i64 }
fn main() {
    let w = Where { file: "a.nika", line: 3 }
    let h = Here { file: "b.nika", line: 4 }
    let p: fs::Path? = "c.nika"
    println(f"{w.line} {h.line} {p == null}")
}

To build

  1. A text (literal, String, view) where an fs::Path? is asked converts as where an fs::Path is asked, then wraps: Some(PathBuf::from(..)) in a struct field, a let with a declared type, an argument and a return; the let row is accepted, not NK1103.
  2. Test tests/compiler/tests/text_stands_where_an_optional_path_is_asked.nika + .stdout (the probe, plus an argument and a return row), refused on the unfixed binary.

Generated by Claude Code

Back to Open Issues