Expand description
Binary format specifications for the RIDX (.ridx) index file.
All integer values are stored in little-endian format. Structures are designed for zero-copy memory-mapped reading with natural alignment.
Re-exports§
pub use crate::driver_hash::*;
Structs§
- Assoc
TyEntry - Associated type binding inside an
ImplEntry(type Item = T;, 16 bytes, 4-byte aligned). - CfgEntry
- Fixed-size 8-byte
cfgtable entry (align 4, zero padding). - DefEntry
- A definition record in the index.
- DefTy
Entry - Structured type/constructor descriptor keyed by
def_index(16bytes,4-byte aligned). - Deref
Entry - Deref target mapping entry for resolving autoderef chains (e.g.
String->str). - Field
Entry - Structured field row for a
Struct,Union, orEnumVariant(20bytes,4-byte aligned). - File
Entry - File table entry: string pool offset for file path, and 64-bit source text provenance hash.
- FnSig
Entry - Structured function or method signature (
16bytes, align4), sorted ascending bydef_index. - Generic
ArgWord - Packed 32-bit generic argument word stored in
ty_args. - Generic
Param Entry - Structured generic parameter declaration (
20bytes,4-byte aligned). - Hash
Index Entry - Hash table entry for $O(\log N)$ or binary search lookup by string hash.
- Header
- Fixed-size header at offset 0 of any .ridx file (format version 5, 416 bytes; v4 is 176, v3 is 160).
- Header
V2 - Fixed-size header for version 2 .ridx files (128 bytes).
- Impl
Entry - Structured inherent or trait
implheader (32 bytes, 4-byte aligned). - Lang
Item Entry - Fixed-size 12-byte lang-item mapping row in
lang_items, sorted bykind. - Macro
DefEntry - Fixed-size 12-byte declarative macro table entry (
align 4, zero wasted alignment gaps). - Note
Entry - A note record: the text a span carries, by kind.
- Owner
Index Entry - Definition owner index entry for fast lookup of methods, fields, and associated items by owner.
- RefEntry
- A reference/usage record pointing to a target definition or symbol.
- Span
- Source location span: file ID and line:column ranges (1-based, inclusive start, exclusive end).
- TyBound
Entry - Trait bound entry used by
Dyn,ImplTrait, and generic predicates (16 bytes). - TyDef
Entry - Interned definition reference for ADTs, traits, and function items in
TyArena(16 bytes). - TyDefId
- 32-bit interned type-level definition reference within a shard’s
ty_defstable. - TyEntry
- Fixed-size 16-byte interned type node in
ty_entries. - TyId
- 32-bit interned type identifier within a shard’s
TyArena. - Type
Entry - Inferred expression type record.
- UseEntry
- Fixed-size 28-byte module
use/ glob / re-export /extern craterow inuses, sorted by(owner_raw, name_str, ...)for O(log N) lookup by owner and identifier. - Where
Pred Entry - Structured
where/ inline bound / supertrait / assoc-item bound predicate (28bytes,4-byte aligned).
Enums§
- Const
Arg - Const generic / array length representation encoded inside a single
u32word. - Ctor
Shape - Syntactic/constructor shape of a
Struct,Union, orEnumVariant. - DefKind
- Category of definition, matching common Rust HIR DefKind.
- Float
TyWidth - Floating-point width.
- FnAbi
Kind - Function pointer ABI category.
- Generic
Owner - Owner of a
GenericParamEntryorWherePredEntryrow (DefEntryorImplEntry). - Generic
Param Kind - Discriminator of a generic parameter (
1byte). - IntTy
Width - Signed integer width.
- ItemVis
- Visibility level matching
DefEntry.visibility(0 = Public, 1 = Crate, 2 = Restricted, 3 = Private). - Lang
Item Kind - Canonical compiler
#[lang = "..."]item (and associated trait item) identifier. - Macro
Delim - Outer delimiter of the macro definition body (
macro_rules! foo { ... }/( ... )/[ ... ]). - Macro
Edition - Hygiene edition of the crate that defined the declarative macro.
- Simplified
Self Kind - Coarse head-constructor discriminator for
ImplEntry.self_ty(1byte). - TyMutability
- Reference or raw-pointer mutability.
- TyTag
- Discriminant tag for
TyEntry(Infer-free by construction). - Uint
TyWidth - Unsigned integer width.
- UseOwner
- Scope owning a
UseEntry(CrateRoot=0,Def(def_index)=def_index + 1). - UsePrim
Ty - Built-in primitive target for
use core::primitive::*/std::primitive::*imports. - Where
Pred Kind - Discriminator of a
WherePredEntryclause (1byte).
Constants§
- BOUND_
FLAG_ MAYBE - CURRENT_
FORMAT_ VERSION - CURRENT_
VERSION - DEF_
TY_ FLAG_ DEFAULT_ ASSOC DefTyEntry.flags: traitAssocTydeclaration carrying a default type (type Item = DefaultTy;).- DEF_
TY_ FLAG_ FUNDAMENTAL DefTyEntry.flags:#[fundamental]ADT (Box<T>,Pin<P>).- DEF_
TY_ FLAG_ MUT_ STATIC DefTyEntry.flags:static mut(Mutability::Mut).- DEF_
TY_ FLAG_ NON_ EXHAUSTIVE DefTyEntry.flags:#[non_exhaustive]onEnumvariant list orStruct/Variantfield list.- DEF_
TY_ FLAG_ UNSAFE_ STATIC DefTyEntry.flags:unsafeextern static (Safety::Unsafe).- EXTRACTOR_
VERSION - FIELD_
FLAG_ TUPLE FieldEntry.flags: positional tuple field (.0,.1, …).- FIELD_
FLAG_ UNSAFE FieldEntry.flags:unsafefield (FieldDef.safety.is_unsafe()).- FLAG_
MACRO_ EXPANSION - A definition record in the index.
- FLAG_
REEXPORT - FN_
FLAG_ ASYNC - FN_
FLAG_ CONST - FN_
FLAG_ HAS_ SELF - FN_
FLAG_ UNSAFE - FN_
FLAG_ VARIADIC - GENERIC_
OWNER_ IMPL_ BIT - High-bit tag in
owner_keydistinguishingImplEntryowners (0x8000_0000 | impl_index) fromDefEntryowners (0..0x7fff_ffff). - GENERIC_
PARAM_ FLAG_ HAS_ DEFAULT GenericParamEntry.flags: parameter declares a default (type T = Uorconst N: usize = 4).- GENERIC_
PARAM_ FLAG_ HOST_ EFFECT GenericParamEntry.flags: compiler host/const effect parameter.- GENERIC_
PARAM_ FLAG_ IS_ SELF GenericParamEntry.flags: implicitSelfparameter (index == 0) on aTraitorTraitAlias.- GENERIC_
PARAM_ FLAG_ SIZED GenericParamEntry.flags:Typeparameter hasSizedbound (unset when?Sized).- GENERIC_
PARAM_ FLAG_ SYNTHETIC GenericParamEntry.flags: syntheticimpl Traitin argument position (APIT).- HEADER_
V3_ SIZE - Size of a version 3 header (160 bytes): before
notesandTyArenasections. - HEADER_
V4_ SIZE - Size of a version 4 header (176 bytes): before
TyArenasections. - IMPL_
FLAG_ CONST ImplEntry.flags:impl const Trait for Self.- IMPL_
FLAG_ NEGATIVE ImplEntry.flags: negative polarity (impl !Send for Self).- IMPL_
FLAG_ RESERVATION ImplEntry.flags: compiler reservation impl (#[rustc_reservation_impl]).- IMPL_
FLAG_ TRAIT ImplEntry.flags:impl Trait for Self(unset for inherentimpl Self).- IMPL_
FLAG_ UNSAFE ImplEntry.flags:unsafe impl Trait for Self.- LIFETIME_
ELIDED - Sentinel lifetime values encoded in
Ref/Dyn/GenericArgWord::from_lifetime. - LIFETIME_
STATIC - MACRO_
FLAG_ BUILTIN - Macro carries
#[rustc_builtin_macro](compiler built-in expansion stub incore/std). - MACRO_
FLAG_ EXPORTED - Macro carries
#[macro_export]. - MACRO_
FLAG_ LOCAL_ INNER - Macro carries
#[macro_export(local_inner_macros)]. - MACRO_
FLAG_ MACRO_ RULES - Macro was defined with
macro_rules!(true) vs declarativemacro2.0 (false). - MAGIC
- NOTE_
CALL_ ARGS - The generic arguments of a call, at the callee’s name:
`T` = `String`, `A` = `Global`. - NOTE_
LAYOUT - The memory layout of a type, field, variant or binding, at its name:
size = 8, align = 0x8, no Drop. - NO_
CFG_ VALUE - Sentinel
value_offsetindicating a bare atom predicate (#[cfg(unix)],#[cfg(test)]) as opposed to a key-value predicate (#[cfg(feature = "std")], including empty""). - USE_
FLAG_ EXTERN_ CRATE extern crate foo [as bar];binding (type_defpoints to target crate rootMod).- USE_
FLAG_ GLOB - Glob import or glob re-export (
use path::*;,name == "*", targetMod/Enumintype_def). - USE_
FLAG_ PRELUDE - Compiler-injected
#[prelude_import]crate-wide prelude glob (std::prelude::rust_2021::*, etc.). - USE_
FLAG_ PRIM_ TY prim_tagcarries a non-zeroUsePrimTyin the type namespace.- USE_
FLAG_ REEXPORT - Exported / re-exported binding (
pub use,pub(crate) use,ModChildre-export, or#[macro_export]). - USE_
FLAG_ UNDERSCORE - Anonymous trait import (
use Trait as _;,name == "_"). - WHERE_
FLAG_ CONST WherePredEntry.flags:consttrait bound (T: ~const Trait/const Trait).- WHERE_
FLAG_ HRTB WherePredEntry.flags: higher-ranked binderfor<'a>wraps this predicate.- WHERE_
FLAG_ NEGATIVE WherePredEntry.flags: negative polarity (T: !Trait).
Functions§
- cache_
object_ path - Returns the path to an object shard inside the global cache for a given unit key.
- compute_
source_ snapshot_ digest - Computes an aggregate 64-bit digest over a map of file paths to their 64-bit source hashes.
- fnv1a_
64 - FNV-1a 64-bit string hash used across the RIDX format.
- is_
readable_ format_ version - Whether a manifest of
format_versioncan be opened: versions 3 and 4 read with empty newer tables. - join_
resolving_ overlap - Joins a base root directory with a relative path, resolving any overlapping path prefix.
- merge_
embedded_ hashes_ authoritative - Merges embedded file hashes into a file_hashes map, ensuring embedded hashes are authoritative
across both package-relative and absolute/canonical aliases under
source_root, and dropping any conflicting aliases. - normalized_
source_ hash - Computes a 64-bit FNV-1a hash over source bytes after stripping UTF-8 BOM and normalizing CRLF to LF, exactly matching rustc’s internal SourceFile.src normalization.
- resolve_
cache_ dir - Resolves the global RIDX shared cache directory for external crate dependencies.
Uses
$RIDX_CACHE_DIRif set, or platform default: - resolve_
cache_ dir_ with