1 //! HIR (previously known as descriptors) provides a high-level object oriented
2 //! access to Rust code.
4 //! The principal difference between HIR and syntax trees is that HIR is bound
5 //! to a particular crate instance. That is, it has cfg flags and features
6 //! applied. So, the relation between syntax and HIR is many-to-one.
8 //! HIR is the public API of the all of the compiler logic above syntax trees.
9 //! It is written in "OO" style. Each type is self contained (as in, it knows it's
10 //! parents and full context). It should be "clean code".
12 //! `hir_*` crates are the implementation of the compiler logic.
13 //! They are written in "ECS" style, with relatively little abstractions.
14 //! Many types are not self-contained, and explicitly use local indexes, arenas, etc.
16 //! `hir` is what insulates the "we don't know how to actually write an incremental compiler"
17 //! from the ide with completions, hovers, etc. It is a (soft, internal) boundary:
18 //! https://www.tedinski.com/2018/02/06/system-boundaries.html.
20 #![recursion_limit = "512"]
34 attrs::{HasAttrs, Namespace},
36 Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const,
37 ConstParam, Crate, CrateDependency, DefWithBody, Enum, Field, FieldSource, Function,
38 GenericDef, GenericParam, HasVisibility, Impl, Label, LifetimeParam, Local, MacroDef,
39 Module, ModuleDef, ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union,
42 has_source::HasSource,
43 semantics::{PathResolution, Semantics, SemanticsScope},
48 attr::{Attrs, Documentation},
49 body::scope::ExprScopes,
50 builtin_type::BuiltinType,
51 find_path::PrefixKind,
54 nameres::ModuleSource,
55 path::{ModPath, PathKind},
56 type_ref::{Mutability, TypeRef},
57 visibility::Visibility,
60 name::{known, AsName, Name},
61 ExpandResult, HirFileId, InFile, MacroCallId, MacroCallLoc, /* FIXME */ MacroDefId,
64 pub use hir_ty::display::HirDisplay;
66 // These are negative re-exports: pub using these names is forbidden, they
67 // should remain private to hir internals.
69 use {hir_def::path::Path, hir_expand::hygiene::Hygiene};