NoReturn
Declares that a function never returns to its caller — it ends the program, loops forever, or transfers control elsewhere. The compiler uses this to check control flow: code after a call to a #NoReturn function is known to be unreachable, and a branch that ends in one satisfies a function that must produce a value.
Syntax
#NoReturn()
func Exit(code: int32);
The attribute takes no arguments — the parentheses are always empty.
Effect on Analysis
Because the compiler knows control never comes back, a #NoReturn call can stand in for a missing return:
#NoReturn()
func Panic(message: Slice<char8>);
func MustParse(text: Slice<char8>) -> int32 {
if let value = TryParse(text) {
return value;
}
Panic("invalid number"); // no return needed — `Panic` never comes back
}
It is the right annotation for process-exit routines, panic/abort handlers, and infinite event loops. The standard library's Panic is declared this way.
See Also
Panic— the standard-library function that uses this attribute- Functions — declarations and return types
- Attributes — the full attribute set
Error
Emits a compiler error at every call site of the annotated function. The build fails at any point where the function is called. Use it to intentionally block usage of a function — for example, to enforce that a stub or unsupported path is never called.
Allow
Suppresses a specific lint on the annotated declaration. The linter's style checks apply everywhere by default; #Allow opts one declaration out when it has a deliberate reason to break a rule.