diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 1d9e7b76c..fc1f054dc 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -20,6 +20,9 @@ pub(crate) use lower::{TypableDef, CallableDef, type_for_def, type_for_field, ca | |||
20 | pub(crate) use infer::{infer, InferenceResult, InferTy}; | 20 | pub(crate) use infer::{infer, InferenceResult, InferTy}; |
21 | use display::{HirDisplay, HirFormatter}; | 21 | use display::{HirDisplay, HirFormatter}; |
22 | 22 | ||
23 | /// A type constructor or type name: this might be something like the primitive | ||
24 | /// type `bool`, a struct like `Vec`, or things like function pointers or | ||
25 | /// tuples. | ||
23 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] | 26 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] |
24 | pub enum TypeCtor { | 27 | pub enum TypeCtor { |
25 | /// The primitive boolean type. Written as `bool`. | 28 | /// The primitive boolean type. Written as `bool`. |
@@ -85,13 +88,19 @@ pub enum TypeCtor { | |||
85 | Tuple, | 88 | Tuple, |
86 | } | 89 | } |
87 | 90 | ||
91 | /// A nominal type with (maybe 0) type parameters. This might be a primitive | ||
92 | /// type like `bool`, a struct, tuple, function pointer, reference or | ||
93 | /// several other things. | ||
88 | #[derive(Clone, PartialEq, Eq, Debug)] | 94 | #[derive(Clone, PartialEq, Eq, Debug)] |
89 | pub struct ApplicationTy { | 95 | pub struct ApplicationTy { |
90 | pub name: TypeCtor, | 96 | pub name: TypeCtor, |
91 | pub parameters: Substs, | 97 | pub parameters: Substs, |
92 | } | 98 | } |
93 | 99 | ||
94 | /// A type. This is based on the `TyKind` enum in rustc (librustc/ty/sty.rs). | 100 | /// A type. |
101 | /// | ||
102 | /// See also the `TyKind` enum in rustc (librustc/ty/sty.rs), which represents | ||
103 | /// the same thing (but in a different way). | ||
95 | /// | 104 | /// |
96 | /// This should be cheap to clone. | 105 | /// This should be cheap to clone. |
97 | #[derive(Clone, PartialEq, Eq, Debug)] | 106 | #[derive(Clone, PartialEq, Eq, Debug)] |
@@ -156,7 +165,8 @@ impl Substs { | |||
156 | } | 165 | } |
157 | } | 166 | } |
158 | 167 | ||
159 | /// A function signature. | 168 | /// A function signature as seen by type inference: Several parameter types and |
169 | /// one return type. | ||
160 | #[derive(Clone, PartialEq, Eq, Debug)] | 170 | #[derive(Clone, PartialEq, Eq, Debug)] |
161 | pub struct FnSig { | 171 | pub struct FnSig { |
162 | params_and_return: Arc<[Ty]>, | 172 | params_and_return: Arc<[Ty]>, |