diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-04 20:03:11 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-04 20:03:11 +0000 |
commit | c08cff4fd67bf754897afa45c856f4b9025b9015 (patch) | |
tree | e70984d904f5ce4d6a9719060c6ee7a46fe14637 /crates/ra_hir/src/ty/lower.rs | |
parent | 9c93fbf346b351795c2e526f5ff7fa693aa50609 (diff) | |
parent | 739babc39188c93eda82ce16a24680bbf2463fa1 (diff) |
Merge #2176
2176: Move Namespace enum closer to usage r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/lower.rs')
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index e29ab8492..d26b16cb2 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -29,10 +29,21 @@ use crate::{ | |||
29 | Adt, | 29 | Adt, |
30 | }, | 30 | }, |
31 | util::make_mut_slice, | 31 | util::make_mut_slice, |
32 | Const, Enum, EnumVariant, Function, ModuleDef, Namespace, Path, Static, Struct, StructField, | 32 | Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, Trait, |
33 | Trait, TypeAlias, Union, | 33 | TypeAlias, Union, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | // FIXME: this is only really used in `type_for_def`, which contains a bunch of | ||
37 | // impossible cases. Perhaps we should recombine `TypeableDef` and `Namespace` | ||
38 | // into a `AsTypeDef`, `AsValueDef` enums? | ||
39 | #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
40 | pub enum Namespace { | ||
41 | Types, | ||
42 | Values, | ||
43 | // Note that only type inference uses this enum, and it doesn't care about macros. | ||
44 | // Macro, | ||
45 | } | ||
46 | |||
36 | impl Ty { | 47 | impl Ty { |
37 | pub(crate) fn from_hir(db: &impl HirDatabase, resolver: &Resolver, type_ref: &TypeRef) -> Self { | 48 | pub(crate) fn from_hir(db: &impl HirDatabase, resolver: &Resolver, type_ref: &TypeRef) -> Self { |
38 | match type_ref { | 49 | match type_ref { |