diff options
author | Florian Diebold <[email protected]> | 2019-03-02 13:53:12 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-03-02 13:53:12 +0000 |
commit | 862b663501570d24deefd72e76dfd4ff35d88e61 (patch) | |
tree | 4f700cec98628d0ea1a1ad704b3d4050ce71680c /crates/ra_hir/src | |
parent | 592b906604d60a86af74c5dbb3bf40b2ddcf8061 (diff) |
A bit of cleanup in ty.rs
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index e505c86e3..78270a9b7 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -54,7 +54,7 @@ pub enum Ty { | |||
54 | /// The pointee of an array slice. Written as `[T]`. | 54 | /// The pointee of an array slice. Written as `[T]`. |
55 | Slice(Arc<Ty>), | 55 | Slice(Arc<Ty>), |
56 | 56 | ||
57 | // An array with the given length. Written as `[T; n]`. | 57 | /// An array with the given length. Written as `[T; n]`. |
58 | Array(Arc<Ty>), | 58 | Array(Arc<Ty>), |
59 | 59 | ||
60 | /// A raw pointer. Written as `*mut T` or `*const T` | 60 | /// A raw pointer. Written as `*mut T` or `*const T` |
@@ -97,36 +97,12 @@ pub enum Ty { | |||
97 | /// ``` | 97 | /// ``` |
98 | FnPtr(Arc<FnSig>), | 98 | FnPtr(Arc<FnSig>), |
99 | 99 | ||
100 | // rustc has a separate type for each function, which just coerces to the | ||
101 | // above function pointer type. Once we implement generics, we will probably | ||
102 | // need this as well. | ||
103 | |||
104 | // A trait, defined with `dyn Trait`. | ||
105 | // Dynamic(), | ||
106 | |||
107 | // The anonymous type of a closure. Used to represent the type of | ||
108 | // `|a| a`. | ||
109 | // Closure(DefId, ClosureSubsts<'tcx>), | ||
110 | |||
111 | // The anonymous type of a generator. Used to represent the type of | ||
112 | // `|a| yield a`. | ||
113 | // Generator(DefId, GeneratorSubsts<'tcx>, hir::GeneratorMovability), | ||
114 | |||
115 | // A type representing the types stored inside a generator. | ||
116 | // This should only appear in GeneratorInteriors. | ||
117 | // GeneratorWitness(Binder<&'tcx List<Ty<'tcx>>>), | ||
118 | /// The never type `!`. | 100 | /// The never type `!`. |
119 | Never, | 101 | Never, |
120 | 102 | ||
121 | /// A tuple type. For example, `(i32, bool)`. | 103 | /// A tuple type. For example, `(i32, bool)`. |
122 | Tuple(Arc<[Ty]>), | 104 | Tuple(Arc<[Ty]>), |
123 | 105 | ||
124 | // The projection of an associated type. For example, | ||
125 | // `<T as Trait<..>>::N`.pub | ||
126 | // Projection(ProjectionTy), | ||
127 | |||
128 | // Opaque (`impl Trait`) type found in a return type. | ||
129 | // Opaque(DefId, Substs), | ||
130 | /// A type parameter; for example, `T` in `fn f<T>(x: T) {} | 106 | /// A type parameter; for example, `T` in `fn f<T>(x: T) {} |
131 | Param { | 107 | Param { |
132 | /// The index of the parameter (starting with parameters from the | 108 | /// The index of the parameter (starting with parameters from the |
@@ -304,9 +280,6 @@ impl Ty { | |||
304 | if (idx as usize) < substs.0.len() { | 280 | if (idx as usize) < substs.0.len() { |
305 | substs.0[idx as usize].clone() | 281 | substs.0[idx as usize].clone() |
306 | } else { | 282 | } else { |
307 | // TODO: does this indicate a bug? i.e. should we always | ||
308 | // have substs for all type params? (they might contain the | ||
309 | // params themselves again...) | ||
310 | Ty::Param { idx, name } | 283 | Ty::Param { idx, name } |
311 | } | 284 | } |
312 | } | 285 | } |