aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-11-02 16:01:38 +0000
committerGitHub <[email protected]>2020-11-02 16:01:38 +0000
commitcb04f0c019bdd77406a7feb6ae7f4a17924d0693 (patch)
tree5bb833b20c4d66a3683ceeb60a922a86284d5ad6 /crates/hir/src
parent731b38fa3c1694648e6c8e60f61820f9783343eb (diff)
parentf5e7f07838975757703a7e00adb45ee43c2d9a1a (diff)
Merge #6440
6440: Deny unreachable pub r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/code_model.rs14
-rw-r--r--crates/hir/src/from_id.rs8
-rw-r--r--crates/hir/src/has_source.rs3
-rw-r--r--crates/hir/src/lib.rs3
4 files changed, 12 insertions, 16 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 563145f92..30a5e4580 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -4,7 +4,6 @@ use std::{iter, sync::Arc};
4use arrayvec::ArrayVec; 4use arrayvec::ArrayVec;
5use base_db::{CrateDisplayName, CrateId, Edition, FileId}; 5use base_db::{CrateDisplayName, CrateId, Edition, FileId};
6use either::Either; 6use either::Either;
7use hir_def::find_path::PrefixKind;
8use hir_def::{ 7use hir_def::{
9 adt::ReprKind, 8 adt::ReprKind,
10 adt::StructKind, 9 adt::StructKind,
@@ -12,16 +11,18 @@ use hir_def::{
12 builtin_type::BuiltinType, 11 builtin_type::BuiltinType,
13 expr::{BindingAnnotation, Pat, PatId}, 12 expr::{BindingAnnotation, Pat, PatId},
14 import_map, 13 import_map,
14 item_tree::ItemTreeNode,
15 lang_item::LangItemTarget, 15 lang_item::LangItemTarget,
16 path::ModPath, 16 path::ModPath,
17 per_ns::PerNs, 17 per_ns::PerNs,
18 resolver::{HasResolver, Resolver}, 18 resolver::{HasResolver, Resolver},
19 src::HasSource as _, 19 src::HasSource as _,
20 type_ref::{Mutability, TypeRef}, 20 type_ref::{Mutability, TypeRef},
21 AdtId, AssocContainerId, AttrDefId, ConstId, DefWithBodyId, EnumId, FunctionId, GenericDefId, 21 AdtId, AssocContainerId, AssocItemId, AssocItemLoc, AttrDefId, ConstId, DefWithBodyId, EnumId,
22 HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId, Lookup, ModuleId, StaticId, 22 FunctionId, GenericDefId, HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId,
23 StructId, TraitId, TypeAliasId, TypeParamId, UnionId, 23 Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, TypeParamId, UnionId,
24}; 24};
25use hir_def::{find_path::PrefixKind, item_scope::ItemInNs, visibility::Visibility};
25use hir_expand::{ 26use hir_expand::{
26 diagnostics::DiagnosticSink, 27 diagnostics::DiagnosticSink,
27 name::{name, AsName}, 28 name::{name, AsName},
@@ -275,11 +276,6 @@ impl ModuleDef {
275 } 276 }
276} 277}
277 278
278pub use hir_def::{
279 attr::Attrs, item_scope::ItemInNs, item_tree::ItemTreeNode, visibility::Visibility,
280 AssocItemId, AssocItemLoc,
281};
282
283impl Module { 279impl Module {
284 pub(crate) fn new(krate: Crate, crate_module_id: LocalModuleId) -> Module { 280 pub(crate) fn new(krate: Crate, crate_module_id: LocalModuleId) -> Module {
285 Module { id: ModuleId { krate: krate.id, local_id: crate_module_id } } 281 Module { id: ModuleId { krate: krate.id, local_id: crate_module_id } }
diff --git a/crates/hir/src/from_id.rs b/crates/hir/src/from_id.rs
index 033f53ac2..265ef6d1f 100644
--- a/crates/hir/src/from_id.rs
+++ b/crates/hir/src/from_id.rs
@@ -4,13 +4,13 @@
4//! are splitting the hir. 4//! are splitting the hir.
5 5
6use hir_def::{ 6use hir_def::{
7 expr::PatId, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId, GenericDefId, 7 expr::PatId, item_scope::ItemInNs, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId,
8 ModuleDefId, VariantId, 8 GenericDefId, ModuleDefId, VariantId,
9}; 9};
10 10
11use crate::{ 11use crate::{
12 code_model::ItemInNs, Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local, 12 Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local, MacroDef, ModuleDef,
13 MacroDef, ModuleDef, VariantDef, 13 VariantDef,
14}; 14};
15 15
16macro_rules! from_id { 16macro_rules! from_id {
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 3bad2338a..c77494152 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -6,6 +6,7 @@ use hir_def::{
6 src::{HasChildSource, HasSource as _}, 6 src::{HasChildSource, HasSource as _},
7 Lookup, VariantId, 7 Lookup, VariantId,
8}; 8};
9use hir_expand::InFile;
9use syntax::ast; 10use syntax::ast;
10 11
11use crate::{ 12use crate::{
@@ -13,8 +14,6 @@ use crate::{
13 Module, Static, Struct, Trait, TypeAlias, TypeParam, Union, 14 Module, Static, Struct, Trait, TypeAlias, TypeParam, Union,
14}; 15};
15 16
16pub use hir_expand::InFile;
17
18pub trait HasSource { 17pub trait HasSource {
19 type Ast; 18 type Ast;
20 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast>; 19 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast>;
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 4094a76cb..0d184379f 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -36,7 +36,7 @@ pub use crate::{
36 Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const, 36 Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const,
37 Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function, 37 Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function,
38 GenericDef, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, 38 GenericDef, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static,
39 Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility, 39 Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
40 }, 40 },
41 has_source::HasSource, 41 has_source::HasSource,
42 semantics::{original_range, PathResolution, Semantics, SemanticsScope}, 42 semantics::{original_range, PathResolution, Semantics, SemanticsScope},
@@ -53,6 +53,7 @@ pub use hir_def::{
53 nameres::ModuleSource, 53 nameres::ModuleSource,
54 path::{ModPath, PathKind}, 54 path::{ModPath, PathKind},
55 type_ref::{Mutability, TypeRef}, 55 type_ref::{Mutability, TypeRef},
56 visibility::Visibility,
56}; 57};
57pub use hir_expand::{ 58pub use hir_expand::{
58 name::known, name::AsName, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, 59 name::known, name::AsName, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc,