Crate ra_ap_hir

Source
Expand description

HIR (previously known as descriptors) provides a high-level object-oriented access to Rust code.

The principal difference between HIR and syntax trees is that HIR is bound to a particular crate instance. That is, it has cfg flags and features applied. So, the relation between syntax and HIR is many-to-one.

HIR is the public API of the all of the compiler logic above syntax trees. It is written in “OO” style. Each type is self contained (as in, it knows its parents and full context). It should be “clean code”.

hir_* crates are the implementation of the compiler logic. They are written in “ECS” style, with relatively little abstractions. Many types are not self-contained, and explicitly use local indexes, arenas, etc.

hir is what insulates the “we don’t know how to actually write an incremental compiler” from the ide with completions, hovers, etc. It is a (soft, internal) boundary: https://www.tedinski.com/2018/02/06/system-boundaries.html.

Re-exports§

pub use crate::diagnostics::*;

Modules§

db
Re-exports various subcrates databases so that the calling code can depend only on hir. This breaks abstraction boundary a bit, it would be cool if we didn’t do that.
diagnostics
Re-export diagnostics such that clients of hir don’t have to depend on low-level crates.
import_map
A map of all publicly exported items in a crate.
mir
MIR definitions and implementation
sym
Module defining all known symbols required by the rest of rust-analyzer.
symbols
File symbol extraction.
term_search
Term search
tt

Macros§

tool_path

Structs§

Adjustment
Attr
AttrId
AttrSourceMap
AttributeTemplate
A template that the attribute input must match. Only top-level shape (#[attr] vs #[attr(...)] vs #[attr = ...]) is considered now.
Attrs
Desugared attributes of an item post cfg_attr expansion.
AttrsWithOwner
BuiltinAttr
BuiltinType
Callable
CaptureUsageSource
CaptureUsages
CfgOptions
Configuration options used for conditional compilation on items with cfg attributes. We have two kind of options in different namespaces: atomic options like unix, and key-value options like target_arch="x86".
ChalkTyInterner
ChangeWithProcMacros
Closure
ClosureCapture
Const
ConstParam
Crate
hir::Crate describes a single crate. It’s the main interface with which a crate’s dependencies interact. Mostly, it should be just a proxy for the root module.
CrateDependency
DefMap
Contains the results of (early) name resolution.
DeriveHelper
DisplayTarget
EditionedFileId
Enum
EvaluatedConst
ExternBlock
ExternCrateDecl
Field
FilePositionWrapper
FileRangeWrapper
Function
GenericSubstitution
Impl
ImportPathConfig
A wrapper around three booleans
InFileWrapper
InFile<T> stores a value of T inside a particular file/syntax tree.
InlineAsmOperand
Label
Layout
LifetimeParam
Local
A single local definition.
LocalSource
Macro
MacroCallId
ModPath
Module
Name
Name is a wrapper around string, which is used in hir for both references and declarations. In theory, names should also carry hygiene info, but we are not there yet!
OverloadedDeref
Param
ProcMacros
ProcMacrosBuilder
SelfParam
Semantics
Primary API to get semantic information, like types, from syntax trees.
SemanticsImpl
SemanticsScope
SemanticsScope encapsulates the notion of a scope (the set of visible names) at a particular program point.
Static
StaticLifetime
Struct
Symbol
ToolModule
Trait
TraitAlias
TraitId
TraitRef
TupleField
Type
TypeAlias
TypeInfo
TypeOrConstParam
TypeParam
Union
Variant
VisibleTraits

Enums§

Access
Adjust
Adt
A Data Type
AssocItem
Invariant: inner.as_assoc_item(db).is_some() We do not actively enforce this invariant.
AssocItemContainer
AutoBorrow
BindingMode
CallableKind
CaptureKind
CastError
CfgAtom
A simple configuration value passed in from the outside.
CfgExpr
ClosureStyle
Complete
#[rust_analyzer::completions(...)] options.
ConstEvalError
DefWithBody
The defs which have a body.
DocLinkDef
Subset of ide_db::Definition that doc links can resolve to.
DropGlue
DynCompatibilityViolation
ExternAssocItem
Invariant: inner.as_extern_assoc_item(db).is_some() We do not actively enforce this invariant.
FieldSource
FnAbi
GenericDef
GenericParam
HirDisplayError
HirFileId
ItemContainer
ItemInNs
LangItem
A representation of all the valid language items in Rust.
LayoutError
MacroKind
MethodViolationCode
MirEvalError
MirLowerError
ModuleDef
The defs which can be visible in the module.
ModuleDefId
The defs which can be visible in the module.
ModuleSource
Mutability
Namespace
PathKind
PathResolution
PointerCast
PrefixKind
Safety
Whether a function is safe or not.
ScopeDef
For IDE only
StructKind
TyFingerprint
This is used as a key for indexing impls.
TypeRef
Compare ty::Ty
UnsafetyReason
Variance
VariantDef
Visibility
Visibility of an item, with the path resolved.

Traits§

AsAssocItem
AsExternAssocItem
HasAttrs
HasContainer
HasCrate
Trait for obtaining the defining crate of an item.
HasSource
HasVisibility
HirDisplay
HirWrite
MethodCandidateCallback
PathCandidateCallback
SyntaxContextExt

Functions§

marks_rev
prettify_macro_expansion
Inserts whitespace and replaces $crate in macro expansions.
resolve_absolute_path
resolve_doc_path_on
Resolves the item link points to in the scope of def.

Type Aliases§

ExpandResult
FilePosition
FileRange
HirFilePosition
HirFileRange
InFile
InMacroFile
InRealFile
MacroFilePosition
MacroFileRange