A Turf file can declare things at its top level – functions, structs, enums, imports, extern bindings, pub immut constants – but it can’t do anything there. Statements (a call, an assignment, a variable, a return, an if) must be inside a function.
import io;io::printline("hello"); // a call, outside any functionfn main(): int { return 0; }Move it into main, which is where a program starts:
import io;fn main(): int { io::printline("hello"); return 0;}If a file has statements at the top level because it was meant to be a script, wrap them in fn main(): int { ... return 0; }.
A top-level unsafe { } block is the same: it can wrap declarations (a struct with a raw-pointer field, an fn), but a statement inside it is still outside any function. Put the statement in a function, inside an unsafe { } of its own.
Run turf --explain E118 in a terminal to read this again.