Skip to content

No return

Chung Leong edited this page Apr 10, 2024 · 3 revisions

noreturn is not a real type in Zig, as it's logically impossible to create an actual instance. It is used to indicate that a function never returns. Such functions are ignored by Zigar.

pub fn panic() noreturn {
    @panic("Wife discovered porn collection");
}
import { panic } from './noreturn-example-1.zig';

console.log(panic);
import module from './noreturn-example-1.zig';

console.log(module.panic);
undefined