Error codes

E0419: a reference-counted type in uses raw code or a raw struct

In a terminal: auk explain E0419 prints this page.

On this page

The runtime is written in the raw dialect (docs/lowlevel.md), which the compiler compiles without reference counting: the allocator and the reference counts themselves are written in it. So a uses raw function, and a raw struct or raw union, holds only types without references: numbers, bool, char, raw pointers, raw structs, [T; N], plain enums and T? of those. An Auk object is reached through a raw.Ptr to the raw struct that mirrors it.

Wrong#

toml
[package]
name = "auk_rt"
version = "0.1.0"
effects = ["raw"]
auk
raw struct Name { len: i64, text: str }

Fixed#

auk
raw struct Name { len: i64, text: raw.Ptr<u8> }

Common causes#

  • A str, list or map in runtime code: use a raw.Ptr to its raw struct (raw.Ptr<Str>).
  • An ordinary struct or enum with fields: declare it as a raw struct.
  • A T! result: return a status code or a T?.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page