The runtime's dialect (docs/lowlevel.md) settles some things when it compiles: the memory
order of an atomic, the initializers of raw let, raw var and export var, and the
layout checks of raw assert. These must be constant expressions (literals, other raw lets,
raw.size_of<T>(), raw.offset_of<T>(.f), arithmetic), and a raw assert must hold.
Wrong#
[package]
name = "auk_rt"
version = "0.1.0"
effects = ["raw"]fn get(p: raw.Ptr<i64>, o: raw.Order): i64 uses raw = raw.atomic_load(p, o)Fixed#
fn get(p: raw.Ptr<i64>): i64 uses raw = raw.atomic_load(p, raw.Order.Acquire)Common causes#
- A memory order passed as a value: write
raw.Order.Xat each atomic. - A global initialized with a function call: compute it at startup instead.
- A
raw asserton a layout that changed: update the raw struct or the C header together.