diff options
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 6cf2c620d..8922163ad 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -19,6 +19,7 @@ use crate::{ | |||
19 | TypeAliasId, | 19 | TypeAliasId, |
20 | }, | 20 | }, |
21 | impl_block::ImplBlock, | 21 | impl_block::ImplBlock, |
22 | name::{BOOL, CHAR, F32, F64, I128, I16, I32, I64, I8, ISIZE, STR, U128, U16, U32, U64, U8, USIZE, SELF_TYPE}, | ||
22 | nameres::{CrateModuleId, ImportId, ModuleScope, Namespace}, | 23 | nameres::{CrateModuleId, ImportId, ModuleScope, Namespace}, |
23 | resolve::Resolver, | 24 | resolve::Resolver, |
24 | traits::{TraitData, TraitItem}, | 25 | traits::{TraitData, TraitItem}, |
@@ -28,7 +29,7 @@ use crate::{ | |||
28 | }, | 29 | }, |
29 | type_ref::Mutability, | 30 | type_ref::Mutability, |
30 | type_ref::TypeRef, | 31 | type_ref::TypeRef, |
31 | AsName, AstDatabase, AstId, DefDatabase, Either, HasSource, HirDatabase, KnownName, Name, Ty, | 32 | AsName, AstDatabase, AstId, DefDatabase, Either, HasSource, HirDatabase, Name, Ty, |
32 | }; | 33 | }; |
33 | 34 | ||
34 | /// hir::Crate describes a single crate. It's the main interface with which | 35 | /// hir::Crate describes a single crate. It's the main interface with which |
@@ -96,27 +97,27 @@ pub enum BuiltinType { | |||
96 | 97 | ||
97 | impl BuiltinType { | 98 | impl BuiltinType { |
98 | #[rustfmt::skip] | 99 | #[rustfmt::skip] |
99 | pub(crate) const ALL: &'static [(KnownName, BuiltinType)] = &[ | 100 | pub(crate) const ALL: &'static [(Name, BuiltinType)] = &[ |
100 | (KnownName::Char, BuiltinType::Char), | 101 | (CHAR, BuiltinType::Char), |
101 | (KnownName::Bool, BuiltinType::Bool), | 102 | (BOOL, BuiltinType::Bool), |
102 | (KnownName::Str, BuiltinType::Str), | 103 | (STR, BuiltinType::Str), |
103 | 104 | ||
104 | (KnownName::Isize, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::Xsize })), | 105 | (ISIZE, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::Xsize })), |
105 | (KnownName::I8, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X8 })), | 106 | (I8, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X8 })), |
106 | (KnownName::I16, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X16 })), | 107 | (I16, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X16 })), |
107 | (KnownName::I32, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X32 })), | 108 | (I32, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X32 })), |
108 | (KnownName::I64, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X64 })), | 109 | (I64, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X64 })), |
109 | (KnownName::I128, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X128 })), | 110 | (I128, BuiltinType::Int(IntTy { signedness: Signedness::Signed, bitness: IntBitness::X128 })), |
110 | 111 | ||
111 | (KnownName::Usize, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::Xsize })), | 112 | (USIZE, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::Xsize })), |
112 | (KnownName::U8, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X8 })), | 113 | (U8, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X8 })), |
113 | (KnownName::U16, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X16 })), | 114 | (U16, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X16 })), |
114 | (KnownName::U32, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X32 })), | 115 | (U32, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X32 })), |
115 | (KnownName::U64, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X64 })), | 116 | (U64, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X64 })), |
116 | (KnownName::U128, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X128 })), | 117 | (U128, BuiltinType::Int(IntTy { signedness: Signedness::Unsigned, bitness: IntBitness::X128 })), |
117 | 118 | ||
118 | (KnownName::F32, BuiltinType::Float(FloatTy { bitness: FloatBitness::X32 })), | 119 | (F32, BuiltinType::Float(FloatTy { bitness: FloatBitness::X32 })), |
119 | (KnownName::F64, BuiltinType::Float(FloatTy { bitness: FloatBitness::X64 })), | 120 | (F64, BuiltinType::Float(FloatTy { bitness: FloatBitness::X64 })), |
120 | ]; | 121 | ]; |
121 | } | 122 | } |
122 | 123 | ||
@@ -560,7 +561,7 @@ impl FnData { | |||
560 | let self_type = if let Some(type_ref) = self_param.ascribed_type() { | 561 | let self_type = if let Some(type_ref) = self_param.ascribed_type() { |
561 | TypeRef::from_ast(type_ref) | 562 | TypeRef::from_ast(type_ref) |
562 | } else { | 563 | } else { |
563 | let self_type = TypeRef::Path(Name::self_type().into()); | 564 | let self_type = TypeRef::Path(SELF_TYPE.into()); |
564 | match self_param.kind() { | 565 | match self_param.kind() { |
565 | ast::SelfParamKind::Owned => self_type, | 566 | ast::SelfParamKind::Owned => self_type, |
566 | ast::SelfParamKind::Ref => { | 567 | ast::SelfParamKind::Ref => { |