Expand description
hir_def
crate contains everything between macro expansion and type
inference.
It defines various items (structs, enums, traits) which comprises Rust code, as well as an algorithm for resolving paths to such entities.
Note that hir_def
is a work in progress, so not all of the above is
actually true.
Re-exports§
pub use self::hir::type_ref;
pub use rustc_abi as layout;
pub use rustc_abi as layout;
pub use rustc_abi as layout;
Modules§
- A higher level attributes based on TokenTree, with also some shortcuts.
- This module defines built-in types.
- Contains basic data about various HIR declarations.
- Defines database & queries for name resolution.
- This module defines a
DynMap
– a container for heterogeneous maps. - Macro expansion utilities.
- Defines
ExpressionStore
: a lowered representation of functions, statics and consts. - An algorithm to find a path to refer to a certain item.
- Many kinds of items or constructs can have generic parameters: functions, structs, impls, traits, etc. This module provides a common HIR for these generic parameters. See also the
Generics
type and thegenerics_of
query in rustc. - This module describes hir-level representation of expressions.
- A map of all publicly exported items in a crate.
- Describes items defined or visible (ie, imported) in a certain scope. This is shared between modules and blocks.
- A simplified AST that only contains items.
- Collects lang items: items marked with
#[lang = "..."]
attribute. - Context for lowering paths.
- This module implements import-resolution/macro expansion algorithm.
- A desugared representation of paths like
crate::foo
or<Type as Trait>::bar
. - In rust, it is possible to have a value, a type and a macro with the same name without conflicts.
- Name resolution façade.
- Utilities for mapping between hir IDs and the surface syntax.
- Defines hir-level representation of visibility (e.g.
pub
andpub(crate)
).
Structs§
- A TypeOrConstParamId with an invariant that it actually belongs to a const
- A
ModuleId
that is always a crate’s root module. - A wrapper around three booleans
- A TypeOrConstParamId with an invariant that it actually belongs to a type
Enums§
- A Data Type
#[rust_analyzer::completions(...)]
options.- The defs which have a body.
- A constant, which might appears as a const item, an anonymous const block in expressions or patterns, or as a constant in types with const generics.
- A generic param
- A macro
- The defs which can be visible in the module.
- Something that holds types, required for the current const arg lowering implementation as they need to be able to query where they are defined.
Traits§
- A helper trait for converting to MacroCallId
- A thing that we want to store in interned ids, but we don’t know its type in
hir-def
. This is currently only used inInTypeConstId
for storing the type (which has typeTy
defined in thehir-ty
crate) of the constant in its id, which is a temporary hack so we may want to remove this after removing that.
Type Aliases§
- An ID of a module, local to a
DefMap
.