Open and answer this issue on GitHub.
ready · opened 2026-11-03 · updated 2026-11-03 · 0 comments
Found by the builder of the guide chapter guide/ownership.md (docs lane, d1). Each one is a defect: the specification (Part I 6.6) says otherwise.
Probes
String and an int is refused, although nothing is lent:
struct Badge { owner: String, number: int }
fn badge_for(name: String, n: int) -> Badge { return Badge { owner: name, number: n } }
// called with "grace".to_uppercase()
The compiler refuses it with NK2302, “hands back a view of n”, even though n is an int. Without the int field the program runs.
let mut y = "short"; let r = longest(x, y); y.push_str("er"); println(r)
The compiler gives NK2105, “longest keeps it”. The right code is NK2305, which is what it gives with "short".to_uppercase().
fn add_guest(names: Vec[String]) { names.push(..) } gets NK1138, which is correct. A second error, NK2105, then appears at the caller and names Vec[ref String]. That second error should not be there.To build
tools/*.nika.tests/compiler/, with its .stdout / .stderr.Also found, for the specification lane (#1213, v1)
"short".clone(), which the compiler refuses today with NK1301.