#Error v0.1.0

Source
Emits a compilation error.

Package: Rux

Signature

intrinsic func #Error(message: Slice<char8>);

Description

#Error stops compilation and reports message as a compile-time error. It runs at compile time, not run time, so it is the way to reject an unsupported configuration while the program is being built — most often the else arm of a when over the target, so that an unsupported platform fails to build rather than misbehaving.

Example

import Core::{ #target, #Error };

when #target.os {
    .Linux => { /* ... */ },
    .Windows => { /* ... */ },
    else => #Error("Unsupported operating system")
}

See also

  • Core — the package overview
  • #Warn — report a compile-time warning without stopping the build
  • #target — the target that is usually being checked
  • Conditional Compilationwhen and the build context