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 asName(arg, ...)in type position and lowered directly toTypeKindvariants 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§
- Builtin
Marker - Definition of a built-in marker.
- Builtin
Type Constructor - Definition of a built-in parameterized type constructor.
- Item
Kinds - 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, eventuallyrust) extend this enum. - Builtin
Type Constructor Kind - Identifier for a built-in parameterized type.
- Lang
Enum Item - Lang-item name applied to an enum declaration.
- Lang
FnItem - 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.).
- Lang
Interface Item - Lang-item name applied to an interface declaration.
- Lang
Item Kind - Classification of a lang-item name string. Returns
Nonefor unrecognized strings. - Marker
Kind - 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). - Thread
Safety - 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.gruelfor 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.