diff options
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r-- | crates/hir/src/lib.rs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs new file mode 100644 index 000000000..24a0f6b4b --- /dev/null +++ b/crates/hir/src/lib.rs | |||
@@ -0,0 +1,59 @@ | |||
1 | //! HIR (previously known as descriptors) provides a high-level object oriented | ||
2 | //! access to Rust code. | ||
3 | //! | ||
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. | ||
7 | //! | ||
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". | ||
11 | //! | ||
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. | ||
15 | //! | ||
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. | ||
19 | |||
20 | #![recursion_limit = "512"] | ||
21 | |||
22 | mod semantics; | ||
23 | pub mod db; | ||
24 | mod source_analyzer; | ||
25 | |||
26 | pub mod diagnostics; | ||
27 | |||
28 | mod from_id; | ||
29 | mod code_model; | ||
30 | |||
31 | mod has_source; | ||
32 | |||
33 | pub use crate::{ | ||
34 | code_model::{ | ||
35 | Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Callable, CallableKind, Const, | ||
36 | Crate, CrateDependency, DefWithBody, Docs, Enum, EnumVariant, Field, FieldSource, Function, | ||
37 | GenericDef, HasAttrs, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, | ||
38 | Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility, | ||
39 | }, | ||
40 | has_source::HasSource, | ||
41 | semantics::{original_range, PathResolution, Semantics, SemanticsScope}, | ||
42 | }; | ||
43 | |||
44 | pub use hir_def::{ | ||
45 | adt::StructKind, | ||
46 | attr::Attrs, | ||
47 | body::scope::ExprScopes, | ||
48 | builtin_type::BuiltinType, | ||
49 | docs::Documentation, | ||
50 | nameres::ModuleSource, | ||
51 | path::{ModPath, Path, PathKind}, | ||
52 | type_ref::{Mutability, TypeRef}, | ||
53 | }; | ||
54 | pub use hir_expand::{ | ||
55 | hygiene::Hygiene, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, | ||
56 | MacroDefId, /* FIXME */ | ||
57 | MacroFile, Origin, | ||
58 | }; | ||
59 | pub use hir_ty::display::HirDisplay; | ||