Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 3.56 KB

appendix-code-index.md

File metadata and controls

29 lines (26 loc) · 3.56 KB

Appendix D: Code Index

rustc has a lot of important data structures. This is an attempt to give some guidance on where to learn more about some of the key data structures of the compiler.

Item Kind Short description Chapter Declaration
CodeMap struct The CodeMap maps the AST nodes to their source code The parser src/libsyntax/codemap.rs
CompileState struct State that is passed to a callback at each compiler pass The Rustc Driver src/librustc_driver/driver.rs
DiagnosticBuilder struct A struct for building up compiler diagnostics, such as errors or lints Emitting Diagnostics src/librustc_errors/diagnostic_builder.rs
DocContext struct A state container used by rustdoc when crawling through a crate to gather its documentation Rustdoc src/librustdoc/core.rs
ast::Crate struct Syntax-level representation of a parsed crate The parser src/librustc/hir/mod.rs
hir::Crate struct More abstract, compiler-friendly form of a crate's AST The Hir src/librustc/hir/mod.rs
ParseSess struct This struct contains information about a parsing session the Parser src/libsyntax/parse/mod.rs
Session struct The data associated with a compilation session the Parser, The Rustc Driver src/librustc/session/mod.html
Span struct A location in the user's source code, used for error reporting primarily Emitting Diagnostics src/libsyntax_pos/span_encoding.rs
StringReader struct This is the lexer used during parsing. It consumes characters from the raw source code being compiled and produces a series of tokens for use by the rest of the parser The parser src/libsyntax/parse/lexer/mod.rs
TraitDef struct This struct contains a trait's definition with type information The ty modules src/librustc/ty/trait_def.rs
Ty<'tcx> struct This is the internal representation of a type used for type checking Type checking src/librustc/ty/mod.rs
TyCtxt<'cx, 'tcx, 'tcx> type The "typing context". This is the central data structure in the compiler. It is the context that you use to perform all manner of queries. The ty modules src/librustc/ty/context.rs