]> git.lizzy.rs Git - rust.git/blob - crates/ra_hir/src/lib.rs
Merge #441
[rust.git] / crates / ra_hir / src / lib.rs
1 //! HIR (previsouly known as descriptors) provides a high-level OO acess to Rust
2 //! 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, there relation between syntax and HIR is many-to-one.
7
8 macro_rules! ctry {
9     ($expr:expr) => {
10         match $expr {
11             None => return Ok(None),
12             Some(it) => it,
13         }
14     };
15 }
16
17 pub mod db;
18 #[cfg(test)]
19 mod mock;
20 mod query_definitions;
21 mod path;
22 pub mod source_binder;
23
24 mod ids;
25 mod macros;
26 mod name;
27 // can't use `crate` or `r#crate` here :(
28 mod krate;
29 mod module;
30 mod function;
31 mod adt;
32 mod type_ref;
33 mod ty;
34 mod impl_block;
35 mod expr;
36
37 use crate::{
38     db::HirDatabase,
39     name::{AsName, KnownName},
40     ids::{DefKind, SourceItemId, SourceFileItemId, SourceFileItems},
41 };
42
43 pub use self::{
44     path::{Path, PathKind},
45     name::Name,
46     krate::Crate,
47     ids::{HirFileId, DefId, DefLoc, MacroCallId, MacroCallLoc},
48     macros::{MacroDef, MacroInput, MacroExpansion},
49     module::{Module, ModuleId, Problem, nameres::{ItemMap, PerNs, Namespace}, ModuleScope, Resolution},
50     function::{Function, FnSignature, FnScopes, ScopesWithSyntaxMapping},
51     adt::{Struct, Enum},
52     ty::Ty,
53     impl_block::{ImplBlock, ImplItem},
54 };
55
56 pub use self::function::FnSignatureInfo;
57
58 pub enum Def {
59     Module(Module),
60     Function(Function),
61     Struct(Struct),
62     Enum(Enum),
63     Item,
64 }