Skip to content

V0101: use of moved context

Contexts (Ctx<M>) are linear: every context operation (++, gen, fork, splice, drop, passing to a function) consumes its input and returns a new handle. Using the old handle afterwards would read KV-cache state that no longer exists, so it is rejected. Rebind the result instead: let c = c ++ "x".

model m = "x" { layers: 1, kv_heads: 1, head_dim: 8 }
fn main() {
let c = open m
let d = c ++ "hi"
let e = c ++ "again" // c was moved into d
drop d, e
}
error[V0101]: use of moved context `c`
--> example.veer:5:11
|
5 | let e = c ++ "again" // c was moved into d
| ^
::: example.veer:4:11
|
4 | let d = c ++ "hi"
| ^ moved here
= note: every context operation consumes its input; rebind the result, e.g. `let c = c ++ "..."`
= help: run `veer explain V0101` for details