From 6269791d3626b9a9e5ea6a11c15e14470c0809a0 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 27 Apr 2019 21:05:59 +0200 Subject: Add Ty::Bound variant for use in Chalk integration --- crates/ra_hir/src/ty.rs | 9 +++++++-- 1 file 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 { name: Name, }, + /// A bound type variable. Only used during trait resolution to represent + /// Chalk variables. + Bound(u32), + /// A type variable used during type checking. Not to be confused with a /// type parameter. Infer(InferTy), @@ -260,7 +264,7 @@ impl Ty { t.walk(f); } } - Ty::Param { .. } | Ty::Infer(_) | Ty::Unknown => {} + Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} } f(self); } @@ -270,7 +274,7 @@ impl Ty { Ty::Apply(a_ty) => { a_ty.parameters.walk_mut(f); } - Ty::Param { .. } | Ty::Infer(_) | Ty::Unknown => {} + Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} } f(self); } @@ -472,6 +476,7 @@ impl HirDisplay for Ty { match self { Ty::Apply(a_ty) => a_ty.hir_fmt(f)?, Ty::Param { name, .. } => write!(f, "{}", name)?, + Ty::Bound(idx) => write!(f, "?{}", idx)?, Ty::Unknown => write!(f, "{{unknown}}")?, Ty::Infer(..) => write!(f, "_")?, } -- cgit v1.2.3