Expand description
HIR provides high-level, object-oriented access to Mun code. It is constructed by first parsing Mun code with the mun_syntax crate and then it is lowered into HIR constructs, names are resolved, and type checking is performed. HIR is the input for both the compiler as well as the language server.
Re-exports§
pub use crate::diagnostics::Diagnostic;
pub use crate::diagnostics::DiagnosticSink;
pub use salsa;
Modules§
- diagnostics
- fixture
- line_
index - semantics
Semantics
provides the means to get semantic information from syntax trees that are not necessarily part of the compilation process. This is useful when you want to extract information from a modified source file in the context of the current state.- with_
fixture
Macros§
Structs§
- AstDatabase
Storage - Representative struct for the query group.
- Body
- The body of an item (function, const etc.).
- DefDatabase
Storage - Representative struct for the query group.
- Expr
Scopes - Field
- A field of a
Struct
. - FileId
FileId
is an integer which uniquely identifies a file. File paths are messy and system-dependent, so most of the code should work directly withFileId
, without inspecting the path. The mapping betweenFileId
and path andSourceRoot
is constant. A file rename is represented as a pair of deletion/creation.- FloatTy
- Function
- Function
Data - HirDatabase
Storage - Representative struct for the query group.
- InFile
InFile<T>
stores a value ofT
inside a particular file/syntax tree.- Inference
Result - The result of type inference: A mapping from expressions and patterns to types.
- IntTy
- Intern
Database Storage - Representative struct for the query group.
- ItemLoc
- Module
- Module
Id - Represents an id of a module inside a package.
- Name
Name
is a wrapper around string, which is used in mun_hir for both references and declarations.- Package
- A
Package
describes a single package. - Package
Id - Represents the id of a single package, all packages have a unique id, the main package and all dependent packages.
- Package
Set - Represents information about a set of packages in a compilation
- Path
- PerNs
- Record
LitField - Resolver
- Source
Database Storage - Representative struct for the query group.
- Source
Root - Source
Root Id - Files are grouped into source roots. A source root is a directory on the file systems which is watched for changes. Typically it corresponds to a single library.
- Struct
- Substitution
- A list of substitutions for generic parameters.
- Ty
- External representation of a type. This should be cheap to clone.
- Type
Alias
Enums§
- ArithOp
- Binary
Op - Callable
Def - CmpOp
- Expr
- Float
Bitness - IntBitness
- Literal
- LogicOp
- Module
Def - Ordering
- Pat
- Similar to
ast::PatKind
- Path
Kind - Signedness
- Statement
- Struct
Memory Kind - Represents the kind of memory management a struct uses.
- TyKind
- A kind of type.
- TypeNs
- UnaryOp
- ValueNs
- Visibility
- Visibility of an item, modules resolved.
Traits§
- AstDatabase
- The
AstDatabase
provides queries that transform text from theSourceDatabase
into an Abstract Syntax Tree (AST). - DefDatabase
- HasSource
- A trait implemented for items that can be related back to their source. The
HasSource::source
method returns the source location of its instance. - HasVisibility
- HirDatabase
- HirDisplay
- Intern
Database - The
InternDatabase
maps certain datastructures to ids. These ids refer to instances of concepts like aFunction
,Struct
orTypeAlias
in a semi-stable way. - Resolve
Bitness - Source
Database - Database which stores all significant input facts: source code and project model.
- Upcast
Functions§
- resolver_
for_ expr - Returns a resolver applicable to the specified expression
- resolver_
for_ scope