ref Vec[i64] reaches rustc as Vec, an owned text is movedOpen and answer this issue on GitHub.
ready, wip · opened 2026-10-31 · updated 2026-10-31 · 1 comment
Found by b12 (#1061, report docs/briefs/bugs/b12-1061-pausing-two-view-field.md.report.md), narrowed by the architect on 46e6179f.
A call through a struct field holding code does not lend its arguments: a list handed to a ref Vec[i64] parameter reaches rustc unborrowed, and an owned text handed to a String parameter (a view by ADR-282 D2) is moved. The same call through a let or a parameter (g(x), apply(count, x)) is right. Not about pausing: the field is sync or not, one view or two.
struct H { f: fn(ref Vec[i64]) -> i64 }
fn count(a: ref Vec[i64]) -> i64 { a.len() }
fn main() {
let h = H { f: count }
let x = [1, 2, 3]
println(h.f(x)) // rustc: Mismatched types, expected `&[i64]`, found `Vec<{integer}>`
}
Row b: struct H { f: fn(String) -> i64 }, let s = f"ab{n}", println(h.f(s)) then println(s): rustc Borrow of moved value: s.
Row c (b12’s): struct H { f: fn(ref Vec[i64], ref Vec[i64]) -> ref Vec[i64] }, h.f(x, y).len(): Arguments to this function are incorrect.
check_core_a_called_field (crates/nikaia-std/src/tools/check_core_args.nika :791) calls check_core_arguments_given and drops its result; the kept-call path check_core_call_kept (check_core_call.nika :174) passes it on to check_core_call_lent (:159), which records facts.lent_args. The field path never does.emit_core_a_field_call (emit_core_reads.nika :339) writes each argument with bare emit_expr; it reads no lent_args (compare emit_core_args, emit_core_args.nika :386).check_core_call_lent with the found types).emit_core_a_field_call (as emit_core_args does), for rows a-c.tests/compiler/tests/a_field_call_lends.nika + .stdout with rows a-c, failing on the unfixed binary.Generated by Claude Code
Second probe (b12 report, 2026-10-31): struct H { f: fn(ref Vec[i64], ref Vec[i64]) -> ref Vec[i64] }, h.f(x, y) with let x = [1, 2, 3] reaches rustc with Arguments to this function are incorrect (expected &[i64], found Vec), also with sync. Brief docs/briefs/bugs/b16-1065-field-call-lends.md, next bug batch.
Generated by Claude Code