2019-01-08 23:47:12 +00:00
|
|
|
//! HIR (previously known as descriptors) provides a high-level object oriented
|
|
|
|
//! access to Rust code.
|
2018-11-28 00:42:26 +00:00
|
|
|
//!
|
|
|
|
//! 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
|
2019-01-08 23:47:12 +00:00
|
|
|
//! applied. So, the relation between syntax and HIR is many-to-one.
|
2018-11-28 00:42:26 +00:00
|
|
|
|
2019-09-30 08:58:53 +00:00
|
|
|
#![recursion_limit = "512"]
|
|
|
|
|
2019-01-24 16:12:11 +00:00
|
|
|
macro_rules! impl_froms {
|
2019-09-12 21:31:04 +00:00
|
|
|
($e:ident: $($v:ident $(($($sv:ident),*))?),*) => {
|
2019-01-24 16:12:11 +00:00
|
|
|
$(
|
|
|
|
impl From<$v> for $e {
|
|
|
|
fn from(it: $v) -> $e {
|
|
|
|
$e::$v(it)
|
|
|
|
}
|
|
|
|
}
|
2019-09-12 21:31:04 +00:00
|
|
|
$($(
|
|
|
|
impl From<$sv> for $e {
|
|
|
|
fn from(it: $sv) -> $e {
|
|
|
|
$e::$v($v::$sv(it))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)*)?
|
2019-01-24 16:12:11 +00:00
|
|
|
)*
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-08 06:48:45 +00:00
|
|
|
pub mod debug;
|
2019-04-10 07:12:54 +00:00
|
|
|
|
2018-11-28 01:09:44 +00:00
|
|
|
pub mod db;
|
2018-12-05 10:16:20 +00:00
|
|
|
pub mod source_binder;
|
2018-11-28 00:42:26 +00:00
|
|
|
|
2019-01-01 19:47:10 +00:00
|
|
|
mod ids;
|
2018-12-20 20:56:28 +00:00
|
|
|
mod ty;
|
2018-12-28 13:34:00 +00:00
|
|
|
mod impl_block;
|
2019-01-05 15:32:07 +00:00
|
|
|
mod expr;
|
2019-03-21 19:13:11 +00:00
|
|
|
pub mod diagnostics;
|
2019-10-14 03:56:18 +00:00
|
|
|
mod util;
|
2018-12-08 20:40:55 +00:00
|
|
|
|
2019-10-31 15:45:10 +00:00
|
|
|
mod from_id;
|
2019-05-23 18:14:19 +00:00
|
|
|
mod code_model;
|
2019-01-04 21:02:05 +00:00
|
|
|
|
2019-09-16 10:48:54 +00:00
|
|
|
pub mod from_source;
|
|
|
|
|
2019-11-04 19:21:15 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
mod test_db;
|
2019-01-23 13:05:13 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
mod marks;
|
|
|
|
|
2019-10-29 12:53:25 +00:00
|
|
|
pub use crate::{
|
2019-10-30 15:50:10 +00:00
|
|
|
code_model::{
|
2019-11-02 20:11:05 +00:00
|
|
|
src::{HasBodySource, HasSource},
|
2019-11-23 11:43:38 +00:00
|
|
|
Adt, AssocItem, AttrDef, Const, Container, Crate, CrateDependency, DefWithBody, Docs, Enum,
|
2019-11-23 08:14:10 +00:00
|
|
|
EnumVariant, FieldSource, Function, GenericDef, GenericParam, HasAttrs, HasBody, ImplBlock,
|
2019-11-23 13:39:53 +00:00
|
|
|
Import, Local, MacroDef, Module, ModuleDef, ModuleSource, ScopeDef, Static, Struct,
|
|
|
|
StructField, Trait, TypeAlias, Union, VariantDef,
|
2019-10-30 15:50:10 +00:00
|
|
|
},
|
2019-04-13 08:24:09 +00:00
|
|
|
expr::ExprScopes,
|
2019-09-16 10:48:54 +00:00
|
|
|
from_source::FromSource,
|
2019-07-04 20:05:17 +00:00
|
|
|
ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile},
|
|
|
|
source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer},
|
2019-09-03 11:10:00 +00:00
|
|
|
ty::{
|
2019-11-11 06:20:18 +00:00
|
|
|
display::HirDisplay,
|
2019-11-13 06:56:33 +00:00
|
|
|
primitive::{FloatBitness, FloatTy, IntBitness, IntTy, Signedness, Uncertain},
|
2019-11-11 06:20:18 +00:00
|
|
|
ApplicationTy, CallableDef, Substs, TraitRef, Ty, TypeCtor, TypeWalk,
|
2019-09-03 11:10:00 +00:00
|
|
|
},
|
2018-11-28 00:42:26 +00:00
|
|
|
};
|
|
|
|
|
2019-10-30 14:24:36 +00:00
|
|
|
pub use hir_def::{
|
2019-10-31 07:51:54 +00:00
|
|
|
builtin_type::BuiltinType,
|
2019-11-23 11:43:38 +00:00
|
|
|
docs::Documentation,
|
2019-10-30 14:24:36 +00:00
|
|
|
path::{Path, PathKind},
|
2019-10-30 14:28:30 +00:00
|
|
|
type_ref::Mutability,
|
2019-10-30 14:24:36 +00:00
|
|
|
};
|
2019-11-02 20:11:05 +00:00
|
|
|
pub use hir_expand::{either::Either, name::Name, Source};
|