Skip to main content

Crate gruel_builtins

Crate gruel_builtins 

Source
Expand description

Built-in registries for the Gruel compiler.

After ADR-0081 retired the STRING_TYPE registry, this crate hosts three smaller registries the compiler still keys off of:

  • Built-in type constructors (BUILTIN_TYPE_CONSTRUCTORS): Ptr, MutPtr, Ref, MutRef, Slice, MutSlice, Vec — written in source as Name(arg, ...) in type position and lowered directly to TypeKind variants by sema.
  • Lang items (LangInterfaceItem, LangEnumItem): the closed set of @lang("…") strings the compiler recognises and binds to prelude interface or enum declarations (Drop, Clone, Handle, Eq, Ord, Ordering).
  • Built-in interface and enum names (BUILTIN_INTERFACE_NAMES, BUILTIN_ENUM_NAMES): breadcrumbs the doc generator and other crates use to refer to prelude declarations without re-typing the strings.

All four prelude-resident built-in enums (Arch, Os, TypeKind, Ownership) and the three interfaces (Drop, Clone, Handle) live in the prelude — see prelude/target.gruel, prelude/type_info.gruel, and prelude/interfaces.gruel. The compiler caches their EnumId / InterfaceIds after declaration resolution; see Sema::cache_builtin_enum_ids in gruel-air.

Structs§

BuiltinMarker
Definition of a built-in marker.
BuiltinTypeConstructor
Definition of a built-in parameterized type constructor.
ItemKinds
Item kinds a marker is applicable to.

Enums§

Abi
ABI marker variants (ADR-0085). C is the only ABI in v1; future values (system, stdcall, vectorcall, eventually rust) extend this enum.
BuiltinTypeConstructorKind
Identifier for a built-in parameterized type.
LangEnumItem
Lang-item name applied to an enum declaration.
LangFnItem
Lang-item name applied to a function declaration. Used for type-constructor functions whose result has compiler-recognized behavior (indexing, slice-borrow, drop synthesis, etc.).
LangInterfaceItem
Lang-item name applied to an interface declaration.
LangItemKind
Classification of a lang-item name string. Returns None for unrecognized strings.
MarkerKind
What a marker conveys to sema. Markers fall into independent “namespaces” — at most one posture marker may attach to a type, and (separately) at most one thread-safety marker. Future markers (e.g. capability tags, layout hints) plug in by adding a new variant without disturbing the existing ones.
Posture
Posture trichotomy carried by MarkerKind::Posture (ADR-0080 / ADR-0083).
ThreadSafety
Thread-safety trichotomy (ADR-0084).

Statics§

BUILTIN_ENUM_NAMES
Names of the prelude-resident built-in enums. Kept here only so other crates have a single source of truth when they need to refer to the names (e.g. for documentation generation).
BUILTIN_INTERFACE_NAMES
Names of the three compiler-recognized built-in interfaces. Kept here only so the doc generator can point at prelude/interfaces.gruel for canonical declarations. Do not use this for anything load-bearing — the compiler resolves these names through the prelude scope.
BUILTIN_MARKERS
All built-in markers recognized by the compiler.
BUILTIN_TYPE_CONSTRUCTORS
All built-in type constructors.
MUT_PTR_CONSTRUCTOR
MutPtr(T) — mutable raw pointer (ADR-0061).
MUT_REF_CONSTRUCTOR
MutRef(T) — mutable reference (ADR-0062).
MUT_SLICE_CONSTRUCTOR
MutSlice(T) — mutable slice (ADR-0064).
PTR_CONSTRUCTOR
Ptr(T) — immutable raw pointer (ADR-0061).
REF_CONSTRUCTOR
Ref(T) — immutable reference (ADR-0062).
SLICE_CONSTRUCTOR
Slice(T) — immutable slice (ADR-0064).
VEC_CONSTRUCTOR
Vec(T) — owned, growable vector (ADR-0066).

Functions§

all_lang_item_names
Closed list of lang-item names recognized by the compiler. Driving data for diagnostics — the actual lookup goes through LangInterfaceItem::from_str / LangEnumItem::from_str / LangFnItem::from_str.
all_marker_names
All recognized marker names (for diagnostic suggestions).
get_builtin_marker
Look up a built-in marker by name.
get_builtin_type_constructor
Look up a built-in type constructor by name.
is_reserved_type_constructor_name
Check if a name is reserved for a built-in type constructor.
render_reference_markdown
Render the reference page for built-in type constructors, enums, and interfaces.