aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-04-27 20:05:59 +0100
committerFlorian Diebold <[email protected]>2019-05-04 17:18:30 +0100
commit6269791d3626b9a9e5ea6a11c15e14470c0809a0 (patch)
tree0084f156f0eabb2631bc650aea6a398ac62f4222 /crates/ra_hir
parente1ea2500fcc5e136fbe6a14c488f558e28519c45 (diff)
Add Ty::Bound variant for use in Chalk integration
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ty.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 12e10c751..094de62a3 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -121,6 +121,10 @@ pub enum Ty {
121 name: Name, 121 name: Name,
122 }, 122 },
123 123
124 /// A bound type variable. Only used during trait resolution to represent
125 /// Chalk variables.
126 Bound(u32),
127
124 /// A type variable used during type checking. Not to be confused with a 128 /// A type variable used during type checking. Not to be confused with a
125 /// type parameter. 129 /// type parameter.
126 Infer(InferTy), 130 Infer(InferTy),
@@ -260,7 +264,7 @@ impl Ty {
260 t.walk(f); 264 t.walk(f);
261 } 265 }
262 } 266 }
263 Ty::Param { .. } | Ty::Infer(_) | Ty::Unknown => {} 267 Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
264 } 268 }
265 f(self); 269 f(self);
266 } 270 }
@@ -270,7 +274,7 @@ impl Ty {
270 Ty::Apply(a_ty) => { 274 Ty::Apply(a_ty) => {
271 a_ty.parameters.walk_mut(f); 275 a_ty.parameters.walk_mut(f);
272 } 276 }
273 Ty::Param { .. } | Ty::Infer(_) | Ty::Unknown => {} 277 Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
274 } 278 }
275 f(self); 279 f(self);
276 } 280 }
@@ -472,6 +476,7 @@ impl HirDisplay for Ty {
472 match self { 476 match self {
473 Ty::Apply(a_ty) => a_ty.hir_fmt(f)?, 477 Ty::Apply(a_ty) => a_ty.hir_fmt(f)?,
474 Ty::Param { name, .. } => write!(f, "{}", name)?, 478 Ty::Param { name, .. } => write!(f, "{}", name)?,
479 Ty::Bound(idx) => write!(f, "?{}", idx)?,
475 Ty::Unknown => write!(f, "{{unknown}}")?, 480 Ty::Unknown => write!(f, "{{unknown}}")?,
476 Ty::Infer(..) => write!(f, "_")?, 481 Ty::Infer(..) => write!(f, "_")?,
477 } 482 }