21Reserved Syntax
The lexer and grammar reserve the following forms because the language plans to use them. The compiler does not yet lower them; using them today either errors at parse time or is silently ignored by later passes. Treat this list as a roadmap, not as features.
| Reserved | Status |
|---|---|
Raw strings r"..." | Reserved. Will treat backslashes literally (no escape processing). Today an r prefix lexes as a separate identifier followed by an ordinary string literal. |
yield | Parser accepts a yield expression; no generator semantics exist. async / await are fully implemented - see section 18. |
Optional chaining ?. | Token reserved; not consumed by the parser. |
Spread ... in calls / literals | The token exists for variadic parameter declarations only. |
| Macros | No macro system exists, and macro is not currently a reserved word (it lexes as an ordinary identifier). A future hygienic macro system may introduce one. |
![pure] | Reserved. Will assert the function has no observable side effects (enabling aggressive folding). Parsed as an unknown directive today (warning + no semantics). |
![const] | Reserved. Will mark a function as evaluable at compile time. |
![noreturn] | Reserved. Will declare a function that never returns normally. |
![constructor] / ![destructor] | Reserved. Will register functions that run before main / after main returns. |
![repr(<int_type>)] on enums | Reserved. Use type enum Foo : u8 { ... } syntax for now; future versions may accept ![repr(u8)] as an equivalent spelling. |
![derive(Trait, ...)] | Reserved. The directive's argument list is parsed and validated (an unknown trait name is rejected), but nothing consumes it: no implementation is synthesized for any listed trait. Copy in particular is decided structurally, not declared - see section 15. |
When any of these moves out of "reserved" and into "implemented," it will be added to the relevant section of this document and removed from this table.
// reservedReserved for future use: the lexer recognises it, but no current syntax gives it meaning. The parser accepts a yield expression, but no generator semantics exist; async / await are the implemented form of suspension.
async function name(param: Type) -> T { ... }Compiles the function into a stackless state machine. Calling it builds a future whose output is the declared return type; nothing runs until that future is polled. Allowed on free functions, methods, and trait methods.
language referenceawait futureSuspends the enclosing async body until the operand - which must implement Future - completes, and evaluates to its output. A prefix operator allowed anywhere an expression is (conditions, arms, guards), but only inside async code.
type struct Name { ... }
type enum Name { ... }
type trait Name { ... }
type union Name { ... }Begins a type declaration; the keyword that follows says which kind. On its own, type Name = Existing; declares an alias.
type enum Name {
Unit,
Payload(T),
Named { x: i32 },
}An algebraic data type. Variants may be bare or carry a tuple or struct payload, and a match on an enum must cover every variant. Name::Variant names a variant; methods are added with implement enum Name { ... }.
type enum Foo : u8function name(count: i32, args...)A variadic parameter: the trailing bucket receives any number of further arguments with C's calling convention, so the function stays ABI-compatible with the printf family. Wrap the bucket in VaArgs to read typed values from it.
type trait Copy {}Types whose values can be duplicated by a bitwise copy. Integers, floats, pointers, and pure-POD structs qualify; anything that owns resources (heap storage, file handles, refcount) does not.
std::core::marker