Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Spec §A — Appendix

A.1 Operator precedence

Tightest to loosest; binary levels are left-associative (§3.7):

LevelOperators
1:: paths · calls · .member · [index] · ! (try) · ?.
2prefix ! - await async & &mut *
3* / %
4+ -
5<< >> (span-adjacent)
6&
7^
8|
9== != < <= > >=
10is
11&&
12||

Above level 12 sit the expression forms (closures, blocks, if, match, for, let, ret, assignment), and above those the top-tier-only forms: const expr and struct initializers (§3.8).

A.2 Reserved words

async  await  borrows  const else    enum   export  external
for    fun    if       impl  import  in     is      jump
let    macro  match    mod   mut     null   own     ret
struct trait  type     use   with    true   false

Contextual (identifier everywhere else): context, void, self, Self, break/continue (after jump), and the attribute names derive service extern must_use rpc trait_only doc expose.

A.3 Literal suffixes

i8 i16 i32 i53 u8 u16 u32 u53 f f32 f64 n — §2.3 (unknown suffixes error; i64/u64 were renamed to i53/u53). Unsuffixed: integer → i32, fractional → f64.

A.4 Lang items

Std declarations the language itself depends on:

ItemModuleLanguage use
primitives (bool, str, numerics, BigInt)std::boolean/string/numberliteral types
List<T>std::listlist literals, for
Option<T>std::option?. results, view-returning lookups
Try, Verdict, Liftstd::operators!, ?. (§5.10)
Add Sub Mul Div Rem Shl Shr BitAnd BitOr BitXorstd::operatorsoperators (§5.7)
PartialEq, PartialOrdstd::compare==/ordering (§5.7)
Iterator/Iterablestd::iteratorfor … in
Task<T>std::taskasync/await (§7.3)
Promise<T>std::promisehost-interop promises (§7.3)
Context<T>std::contextcontexts (§8)
panic, assertstd::iodivergence, vilan test