aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/traits.rs')
-rw-r--r--crates/ra_hir_ty/src/traits.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs
index a1ca33c98..07854a062 100644
--- a/crates/ra_hir_ty/src/traits.rs
+++ b/crates/ra_hir_ty/src/traits.rs
@@ -7,7 +7,7 @@ use ra_db::{impl_intern_key, salsa, CrateId};
7use ra_prof::profile; 7use ra_prof::profile;
8use rustc_hash::FxHashSet; 8use rustc_hash::FxHashSet;
9 9
10use crate::db::HirDatabase; 10use crate::{db::HirDatabase, DebruijnIndex};
11 11
12use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; 12use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk};
13 13
@@ -128,7 +128,11 @@ impl TypeWalk for ProjectionPredicate {
128 self.ty.walk(f); 128 self.ty.walk(f);
129 } 129 }
130 130
131 fn walk_mut_binders(&mut self, f: &mut impl FnMut(&mut Ty, usize), binders: usize) { 131 fn walk_mut_binders(
132 &mut self,
133 f: &mut impl FnMut(&mut Ty, DebruijnIndex),
134 binders: DebruijnIndex,
135 ) {
132 self.projection_ty.walk_mut_binders(f, binders); 136 self.projection_ty.walk_mut_binders(f, binders);
133 self.ty.walk_mut_binders(f, binders); 137 self.ty.walk_mut_binders(f, binders);
134 } 138 }
@@ -144,7 +148,7 @@ pub(crate) fn trait_solve_query(
144 Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(), 148 Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(),
145 Obligation::Projection(_) => "projection".to_string(), 149 Obligation::Projection(_) => "projection".to_string(),
146 }); 150 });
147 log::debug!("trait_solve_query({})", goal.value.value.display(db)); 151 eprintln!("trait_solve_query({})", goal.value.value.display(db));
148 152
149 if let Obligation::Projection(pred) = &goal.value.value { 153 if let Obligation::Projection(pred) = &goal.value.value {
150 if let Ty::Bound(_) = &pred.projection_ty.parameters[0] { 154 if let Ty::Bound(_) = &pred.projection_ty.parameters[0] {
@@ -153,7 +157,7 @@ pub(crate) fn trait_solve_query(
153 } 157 }
154 } 158 }
155 159
156 let canonical = goal.to_chalk(db).cast(); 160 let canonical = goal.to_chalk(db).cast(&Interner);
157 161
158 // We currently don't deal with universes (I think / hope they're not yet 162 // We currently don't deal with universes (I think / hope they're not yet
159 // relevant for our use cases?) 163 // relevant for our use cases?)
@@ -194,8 +198,8 @@ fn solution_from_chalk(
194 let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<Interner>>| { 198 let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<Interner>>| {
195 let value = subst 199 let value = subst
196 .value 200 .value
197 .into_iter() 201 .iter(&Interner)
198 .map(|p| match p.ty() { 202 .map(|p| match p.ty(&Interner) {
199 Some(ty) => from_chalk(db, ty.clone()), 203 Some(ty) => from_chalk(db, ty.clone()),
200 None => unimplemented!(), 204 None => unimplemented!(),
201 }) 205 })