Crate ra_ap_hir_expand[−][src]
Expand description
hir_expand
deals with macro expansion.
Specifically, it implements a concept of MacroFile
– a file whose syntax
tree originates not from the text of some FileId
, but from some macro
expansion.
Modules
AstIdMap
allows to create stable IDs for “large” syntax nodes like items
and macro calls.
Builtin attributes.
Builtin derives.
Builtin macro
Defines database & queries for macro expansion.
Eager expansion related utils
This modules handles hygiene information.
Proc Macro Expander stub
A simplified version of quote-crate like quasi quote macro
Macros
Structs
ExpansionInfo mainly describes how to map text range between src and expanded macro
Input to the analyzer is a set of files, where each file is identified by
FileId
and contains source code. However, another source of source code in
Rust are macros: each macro can be thought of as producing a “temporary
file”. To assign an id to such a file, we use the id of the macro call that
produced the file. So, a HirFileId
is either a FileId
(source code
written by user), or a MacroCallId
(source code produced by macro).
InFile<T>
stores a value of T
inside a particular file/syntax tree.
MacroCallId
identifies a particular macro invocation, like
println!("Hello, {}", world)
.
Enums
In Rust, macros expand token trees to token trees. When we want to turn a
token tree into an AST node, we need to figure out what kind of AST node we
want: something like foo
can be a type, an expression, or a pattern.
Type Definitions
AstId
points to an AST node in any file.