From d5d485ef9289589332893f2c0ad96cb366afe9d6 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 28 Jun 2020 21:17:27 +0200 Subject: Implement Chalk variable kinds This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.) Should fix the last remaining issue of #2534. --- crates/ra_hir/src/code_model.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index e86077dd6..479c82fa4 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -1187,7 +1187,7 @@ impl Type { None => return false, }; - let canonical_ty = Canonical { value: self.ty.value.clone(), num_vars: 0 }; + let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; method_resolution::implements_trait( &canonical_ty, db, @@ -1211,7 +1211,7 @@ impl Type { self.ty.environment.clone(), hir_ty::Obligation::Trait(trait_ref), ), - num_vars: 0, + kinds: Arc::new([]), }; db.trait_solve(self.krate, goal).is_some() @@ -1286,7 +1286,7 @@ impl Type { pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator + 'a { // There should be no inference vars in types passed here // FIXME check that? - let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 }; + let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; let environment = self.ty.environment.clone(); let ty = InEnvironment { value: canonical, environment }; autoderef(db, Some(self.krate), ty) @@ -1327,7 +1327,7 @@ impl Type { // There should be no inference vars in types passed here // FIXME check that? // FIXME replace Unknown by bound vars here - let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 }; + let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; let env = self.ty.environment.clone(); let krate = krate.id; @@ -1358,7 +1358,7 @@ impl Type { // There should be no inference vars in types passed here // FIXME check that? // FIXME replace Unknown by bound vars here - let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 }; + let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; let env = self.ty.environment.clone(); let krate = krate.id; -- cgit v1.2.3