Docs/Language

Language

Attributes & derives

GitHub

Supported declaration attributes, test metadata, derives, and FFI annotations.

Attributes use @name(...) syntax and are checked against the declaration they annotate. Unknown attributes, invalid targets, duplicate non-repeatable attributes, and conflicting attributes are compile-time errors.

Tests and benchmarks

@test marks a zero-argument Aura function for aura test. Optional metadata is supported:

aura
@test(tag = "fast")
fun adds() {
  assert_eq(1 + 1, 2)
}

@test(ignore = true)
fun pending() {}

@bench is accepted as function metadata. Test functions cannot be generic, take parameters, or be async in the current runner.

Derives

@derive applies to a class or struct. The current implementations support the following generated methods:

aura
@derive(Equals, HashCode, Debug)
struct Point(val x: Int, val y: Int) {}

Supported names and generated surface:

DeriveGenerated method
Eq / Equalsequals(other)
Hash / HashCodehashCode()
Debug / DebugStringtoString() / debug text

Derives follow the type's field constraints. Unsupported field types produce semantic diagnostics instead of silently generating partial methods.

API and code-generation metadata

AttributeTargetsPurpose
@deprecated("message") or @deprecated(since = "...")declarationsMark an API as deprecated
@inline / @noinline / @coldfunctions and methodsBackend optimization hints
@throwsfunctions and methodsDeclare exception metadata
@unsafetypes, functions, methodsMark an unsafe boundary
@repr(Name)typesSelect a representation metadata name
@reflecttypesRetain reflection metadata
@notNullparametersRequire a non-null parameter contract

@inline and @noinline conflict when placed on the same declaration. Metadata does not replace type checking or ownership checks.

Foreign declarations

@foreign annotates an external function declaration and requires named ABI metadata:

aura
@foreign(library = "m", target = "native", link = "dynamic", abi = 1, abi_id = "c")
extern "C" fun native_abs(value: Int): Int

Supported metadata includes library, target, link, abi, abi_id, and optional failure. Foreign declarations are an explicit runtime/codegen boundary; they do not automatically make native resources safe to retain.

All docs pages