aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-03-21 21:23:52 +0000
committerFlorian Diebold <[email protected]>2019-03-21 21:23:52 +0000
commit97be0e6c46196552607aa0121b32a41a3515873d (patch)
tree9186866102e3217af63e2a1b53704cecf364add5 /crates/ra_hir/src/ty.rs
parentf10f5a81b326d161d9ed1fba263de972b89de2bf (diff)
Some more doc comments
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r--crates/ra_hir/src/ty.rs14
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
20pub(crate) use infer::{infer, InferenceResult, InferTy}; 20pub(crate) use infer::{infer, InferenceResult, InferTy};
21use display::{HirDisplay, HirFormatter}; 21use 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)]
24pub enum TypeCtor { 27pub 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)]
89pub struct ApplicationTy { 95pub 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)]
161pub struct FnSig { 171pub struct FnSig {
162 params_and_return: Arc<[Ty]>, 172 params_and_return: Arc<[Ty]>,