Docs menu

E112: void can't be the type of a variable, field or parameter

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

void means “nothing”. It describes a function that gives nothing back, so it can only appear as a function’s return type:

Example
fn log(msg: string): void { ... }        // fine

A variable, a struct field or a parameter holds a value, and “nothing” can’t be held:

Example
mut x: void;                  // what would x contain?struct Box { item: void }fn show(thing: void): void { ... }

Give it a real type – int, string, a struct, … If you need a pointer to something whose type you don’t know (in extern code), use ptr or void* instead.

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

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

Esc

Type to search.