Docs menu

E122: Turf can't take the address of that

What compiler error E122 means, and how to fix it.

&x gives you a reference to something that lives in memory, so it only works on things that have a place: a variable, a struct field, or an array element.

Example
mut x: int = 5;mut r: &int = &x;                 // a variable: finemut p: &int = &point.x;           // a field: finemut q: &int = &numbers[2];        // an array element: fine

A computed result has no place – it is a temporary value that disappears – so there is nothing to point at:

Example
mut r: &int = &(x + 1);           // (x + 1) is a value, not a placemut r: &int = &compute();         // so is a function's result

Store the value in a variable first, then take the address of the variable:

Example
mut tmp: int = x + 1;mut r: &int = &tmp;

Run turf --explain E122 in a terminal to read this again.

Last updated: Oct 15, 2026Edit this page on GitHub

Esc

Type to search.