.clone() of a Vec[String] from a map get/values or a for element is typed Vec[ref String] (NK1103)Open and answer this issue on GitHub.
ready · opened 2026-11-02 · updated 2026-11-02 · 0 comments
Found during the M7 move (emit_contracts.nika, Part of #125).
Probe: take a Vec[String] out of a map by get or values, or as the element of a for loop over a list of such vectors, and call .clone() on it. The checker types the result as Vec[ref String] and refuses the assignment to a Vec[String] with NK1103. A clone of an owned value is meant to be owned.
This is the same family as 5a5f1aa4 (a number taken out of a map pair in a lambda’s tuple pattern was typed ref i64).
To build
tests/compiler/ program for the three sources (map get, map values, for element), with its .stdout..clone() of a borrowed Vec[T] is Vec[T]. The test passes at --both-settings.