aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock55
-rw-r--r--crates/ra_hir/Cargo.toml6
-rw-r--r--crates/ra_hir/src/db.rs17
-rw-r--r--crates/ra_hir/src/ty/traits.rs9
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs32
5 files changed, 65 insertions, 54 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 88fb66a56..16fbe7502 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -123,7 +123,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
123[[package]] 123[[package]]
124name = "chalk-derive" 124name = "chalk-derive"
125version = "0.1.0" 125version = "0.1.0"
126source = "git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d#102eba3659fc26a2451ed845f9ca4ceb8f79c22d" 126source = "git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478#a88cad7f0a69e05ba8f40b74c58a1c229c1b2478"
127dependencies = [ 127dependencies = [
128 "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 128 "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
129 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 129 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -133,9 +133,9 @@ dependencies = [
133[[package]] 133[[package]]
134name = "chalk-engine" 134name = "chalk-engine"
135version = "0.9.0" 135version = "0.9.0"
136source = "git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d#102eba3659fc26a2451ed845f9ca4ceb8f79c22d" 136source = "git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478#a88cad7f0a69e05ba8f40b74c58a1c229c1b2478"
137dependencies = [ 137dependencies = [
138 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 138 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
139 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 139 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
140 "stacker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 140 "stacker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
141] 141]
@@ -143,18 +143,18 @@ dependencies = [
143[[package]] 143[[package]]
144name = "chalk-ir" 144name = "chalk-ir"
145version = "0.1.0" 145version = "0.1.0"
146source = "git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d#102eba3659fc26a2451ed845f9ca4ceb8f79c22d" 146source = "git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478#a88cad7f0a69e05ba8f40b74c58a1c229c1b2478"
147dependencies = [ 147dependencies = [
148 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 148 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
149 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 149 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
150 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 150 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
151 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", 151 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
152] 152]
153 153
154[[package]] 154[[package]]
155name = "chalk-macros" 155name = "chalk-macros"
156version = "0.1.1" 156version = "0.1.1"
157source = "git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d#102eba3659fc26a2451ed845f9ca4ceb8f79c22d" 157source = "git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478#a88cad7f0a69e05ba8f40b74c58a1c229c1b2478"
158dependencies = [ 158dependencies = [
159 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 159 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
160] 160]
@@ -162,23 +162,24 @@ dependencies = [
162[[package]] 162[[package]]
163name = "chalk-rust-ir" 163name = "chalk-rust-ir"
164version = "0.1.0" 164version = "0.1.0"
165source = "git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d#102eba3659fc26a2451ed845f9ca4ceb8f79c22d" 165source = "git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478#a88cad7f0a69e05ba8f40b74c58a1c229c1b2478"
166dependencies = [ 166dependencies = [
167 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 167 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
168 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 168 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
169 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 169 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
170 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 170 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
171] 171]
172 172
173[[package]] 173[[package]]
174name = "chalk-solve" 174name = "chalk-solve"
175version = "0.1.0" 175version = "0.1.0"
176source = "git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d#102eba3659fc26a2451ed845f9ca4ceb8f79c22d" 176source = "git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478#a88cad7f0a69e05ba8f40b74c58a1c229c1b2478"
177dependencies = [ 177dependencies = [
178 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 178 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
179 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 179 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
180 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 180 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
181 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 181 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
182 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
182 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", 183 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
183 "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 184 "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
184 "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", 185 "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1016,9 +1017,9 @@ name = "ra_hir"
1016version = "0.1.0" 1017version = "0.1.0"
1017dependencies = [ 1018dependencies = [
1018 "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 1019 "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1019 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 1020 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
1020 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 1021 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
1021 "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)", 1022 "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)",
1022 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", 1023 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
1023 "insta 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 1024 "insta 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
1024 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", 1025 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1873,12 +1874,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1873"checksum cargo_metadata 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8d2d1617e838936c0d2323a65cc151e03ae19a7678dd24f72bccf27119b90a5d" 1874"checksum cargo_metadata 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8d2d1617e838936c0d2323a65cc151e03ae19a7678dd24f72bccf27119b90a5d"
1874"checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8" 1875"checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
1875"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 1876"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
1876"checksum chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)" = "<none>" 1877"checksum chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)" = "<none>"
1877"checksum chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)" = "<none>" 1878"checksum chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)" = "<none>"
1878"checksum chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)" = "<none>" 1879"checksum chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)" = "<none>"
1879"checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)" = "<none>" 1880"checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)" = "<none>"
1880"checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)" = "<none>" 1881"checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)" = "<none>"
1881"checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=102eba3659fc26a2451ed845f9ca4ceb8f79c22d)" = "<none>" 1882"checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=a88cad7f0a69e05ba8f40b74c58a1c229c1b2478)" = "<none>"
1882"checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68" 1883"checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68"
1883"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" 1884"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
1884"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 1885"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml
index 57b7da1a8..20f6e3649 100644
--- a/crates/ra_hir/Cargo.toml
+++ b/crates/ra_hir/Cargo.toml
@@ -23,9 +23,9 @@ hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
23test_utils = { path = "../test_utils" } 23test_utils = { path = "../test_utils" }
24ra_prof = { path = "../ra_prof" } 24ra_prof = { path = "../ra_prof" }
25 25
26chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "102eba3659fc26a2451ed845f9ca4ceb8f79c22d" } 26chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "a88cad7f0a69e05ba8f40b74c58a1c229c1b2478" }
27chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "102eba3659fc26a2451ed845f9ca4ceb8f79c22d" } 27chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "a88cad7f0a69e05ba8f40b74c58a1c229c1b2478" }
28chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "102eba3659fc26a2451ed845f9ca4ceb8f79c22d" } 28chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "a88cad7f0a69e05ba8f40b74c58a1c229c1b2478" }
29lalrpop-intern = "0.15.1" 29lalrpop-intern = "0.15.1"
30 30
31[dev-dependencies] 31[dev-dependencies]
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index d9fad0ae2..d75d71d66 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -125,31 +125,38 @@ pub trait HirDatabase: DefDatabase + AstDatabase {
125 fn intern_assoc_ty_value(&self, assoc_ty_value: AssocTyValue) -> ids::AssocTyValueId; 125 fn intern_assoc_ty_value(&self, assoc_ty_value: AssocTyValue) -> ids::AssocTyValueId;
126 126
127 #[salsa::invoke(crate::ty::traits::chalk::associated_ty_data_query)] 127 #[salsa::invoke(crate::ty::traits::chalk::associated_ty_data_query)]
128 fn associated_ty_data(&self, id: chalk_ir::TypeId) -> Arc<chalk_rust_ir::AssociatedTyDatum>; 128 fn associated_ty_data(
129 &self,
130 id: chalk_ir::TypeId,
131 ) -> Arc<chalk_rust_ir::AssociatedTyDatum<chalk_ir::family::ChalkIr>>;
129 132
130 #[salsa::invoke(crate::ty::traits::chalk::trait_datum_query)] 133 #[salsa::invoke(crate::ty::traits::chalk::trait_datum_query)]
131 fn trait_datum( 134 fn trait_datum(
132 &self, 135 &self,
133 krate: Crate, 136 krate: Crate,
134 trait_id: chalk_ir::TraitId, 137 trait_id: chalk_ir::TraitId,
135 ) -> Arc<chalk_rust_ir::TraitDatum>; 138 ) -> Arc<chalk_rust_ir::TraitDatum<chalk_ir::family::ChalkIr>>;
136 139
137 #[salsa::invoke(crate::ty::traits::chalk::struct_datum_query)] 140 #[salsa::invoke(crate::ty::traits::chalk::struct_datum_query)]
138 fn struct_datum( 141 fn struct_datum(
139 &self, 142 &self,
140 krate: Crate, 143 krate: Crate,
141 struct_id: chalk_ir::StructId, 144 struct_id: chalk_ir::StructId,
142 ) -> Arc<chalk_rust_ir::StructDatum>; 145 ) -> Arc<chalk_rust_ir::StructDatum<chalk_ir::family::ChalkIr>>;
143 146
144 #[salsa::invoke(crate::ty::traits::chalk::impl_datum_query)] 147 #[salsa::invoke(crate::ty::traits::chalk::impl_datum_query)]
145 fn impl_datum(&self, krate: Crate, impl_id: chalk_ir::ImplId) -> Arc<chalk_rust_ir::ImplDatum>; 148 fn impl_datum(
149 &self,
150 krate: Crate,
151 impl_id: chalk_ir::ImplId,
152 ) -> Arc<chalk_rust_ir::ImplDatum<chalk_ir::family::ChalkIr>>;
146 153
147 #[salsa::invoke(crate::ty::traits::chalk::associated_ty_value_query)] 154 #[salsa::invoke(crate::ty::traits::chalk::associated_ty_value_query)]
148 fn associated_ty_value( 155 fn associated_ty_value(
149 &self, 156 &self,
150 krate: Crate, 157 krate: Crate,
151 id: chalk_rust_ir::AssociatedTyValueId, 158 id: chalk_rust_ir::AssociatedTyValueId,
152 ) -> Arc<chalk_rust_ir::AssociatedTyValue>; 159 ) -> Arc<chalk_rust_ir::AssociatedTyValue<chalk_ir::family::ChalkIr>>;
153 160
154 #[salsa::invoke(crate::ty::traits::trait_solve_query)] 161 #[salsa::invoke(crate::ty::traits::trait_solve_query)]
155 fn trait_solve( 162 fn trait_solve(
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs
index 99dbab99e..45f725438 100644
--- a/crates/ra_hir/src/ty/traits.rs
+++ b/crates/ra_hir/src/ty/traits.rs
@@ -17,7 +17,7 @@ pub(crate) mod chalk;
17#[derive(Debug, Clone)] 17#[derive(Debug, Clone)]
18pub struct TraitSolver { 18pub struct TraitSolver {
19 krate: Crate, 19 krate: Crate,
20 inner: Arc<Mutex<chalk_solve::Solver>>, 20 inner: Arc<Mutex<chalk_solve::Solver<ChalkIr>>>,
21} 21}
22 22
23/// We need eq for salsa 23/// We need eq for salsa
@@ -34,7 +34,7 @@ impl TraitSolver {
34 &self, 34 &self,
35 db: &impl HirDatabase, 35 db: &impl HirDatabase,
36 goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<ChalkIr>>>, 36 goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<ChalkIr>>>,
37 ) -> Option<chalk_solve::Solution> { 37 ) -> Option<chalk_solve::Solution<ChalkIr>> {
38 let context = ChalkContext { db, krate: self.krate }; 38 let context = ChalkContext { db, krate: self.krate };
39 debug!("solve goal: {:?}", goal); 39 debug!("solve goal: {:?}", goal);
40 let mut solver = match self.inner.lock() { 40 let mut solver = match self.inner.lock() {
@@ -196,7 +196,10 @@ pub(crate) fn trait_solve_query(
196 solution.map(|solution| solution_from_chalk(db, solution)) 196 solution.map(|solution| solution_from_chalk(db, solution))
197} 197}
198 198
199fn solution_from_chalk(db: &impl HirDatabase, solution: chalk_solve::Solution) -> Solution { 199fn solution_from_chalk(
200 db: &impl HirDatabase,
201 solution: chalk_solve::Solution<ChalkIr>,
202) -> Solution {
200 let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<ChalkIr>>| { 203 let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<ChalkIr>>| {
201 let value = subst 204 let value = subst
202 .value 205 .value
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index 81a378bac..9bf93981a 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -418,20 +418,20 @@ fn convert_where_clauses(
418 result 418 result
419} 419}
420 420
421impl<'a, DB> chalk_solve::RustIrDatabase for ChalkContext<'a, DB> 421impl<'a, DB> chalk_solve::RustIrDatabase<ChalkIr> for ChalkContext<'a, DB>
422where 422where
423 DB: HirDatabase, 423 DB: HirDatabase,
424{ 424{
425 fn associated_ty_data(&self, id: TypeId) -> Arc<AssociatedTyDatum> { 425 fn associated_ty_data(&self, id: TypeId) -> Arc<AssociatedTyDatum<ChalkIr>> {
426 self.db.associated_ty_data(id) 426 self.db.associated_ty_data(id)
427 } 427 }
428 fn trait_datum(&self, trait_id: chalk_ir::TraitId) -> Arc<TraitDatum> { 428 fn trait_datum(&self, trait_id: chalk_ir::TraitId) -> Arc<TraitDatum<ChalkIr>> {
429 self.db.trait_datum(self.krate, trait_id) 429 self.db.trait_datum(self.krate, trait_id)
430 } 430 }
431 fn struct_datum(&self, struct_id: chalk_ir::StructId) -> Arc<StructDatum> { 431 fn struct_datum(&self, struct_id: chalk_ir::StructId) -> Arc<StructDatum<ChalkIr>> {
432 self.db.struct_datum(self.krate, struct_id) 432 self.db.struct_datum(self.krate, struct_id)
433 } 433 }
434 fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum> { 434 fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum<ChalkIr>> {
435 self.db.impl_datum(self.krate, impl_id) 435 self.db.impl_datum(self.krate, impl_id)
436 } 436 }
437 fn impls_for_trait( 437 fn impls_for_trait(
@@ -484,7 +484,7 @@ where
484 fn associated_ty_value( 484 fn associated_ty_value(
485 &self, 485 &self,
486 id: chalk_rust_ir::AssociatedTyValueId, 486 id: chalk_rust_ir::AssociatedTyValueId,
487 ) -> Arc<AssociatedTyValue> { 487 ) -> Arc<AssociatedTyValue<ChalkIr>> {
488 self.db.associated_ty_value(self.krate, id) 488 self.db.associated_ty_value(self.krate, id)
489 } 489 }
490 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<ChalkIr>> { 490 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<ChalkIr>> {
@@ -502,7 +502,7 @@ where
502pub(crate) fn associated_ty_data_query( 502pub(crate) fn associated_ty_data_query(
503 db: &impl HirDatabase, 503 db: &impl HirDatabase,
504 id: TypeId, 504 id: TypeId,
505) -> Arc<AssociatedTyDatum> { 505) -> Arc<AssociatedTyDatum<ChalkIr>> {
506 debug!("associated_ty_data {:?}", id); 506 debug!("associated_ty_data {:?}", id);
507 let type_alias: TypeAlias = from_chalk(db, id); 507 let type_alias: TypeAlias = from_chalk(db, id);
508 let trait_ = match type_alias.container(db) { 508 let trait_ = match type_alias.container(db) {
@@ -528,7 +528,7 @@ pub(crate) fn trait_datum_query(
528 db: &impl HirDatabase, 528 db: &impl HirDatabase,
529 krate: Crate, 529 krate: Crate,
530 trait_id: chalk_ir::TraitId, 530 trait_id: chalk_ir::TraitId,
531) -> Arc<TraitDatum> { 531) -> Arc<TraitDatum<ChalkIr>> {
532 debug!("trait_datum {:?}", trait_id); 532 debug!("trait_datum {:?}", trait_id);
533 if trait_id == UNKNOWN_TRAIT { 533 if trait_id == UNKNOWN_TRAIT {
534 let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses: Vec::new() }; 534 let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses: Vec::new() };
@@ -585,7 +585,7 @@ pub(crate) fn struct_datum_query(
585 db: &impl HirDatabase, 585 db: &impl HirDatabase,
586 krate: Crate, 586 krate: Crate,
587 struct_id: chalk_ir::StructId, 587 struct_id: chalk_ir::StructId,
588) -> Arc<StructDatum> { 588) -> Arc<StructDatum<ChalkIr>> {
589 debug!("struct_datum {:?}", struct_id); 589 debug!("struct_datum {:?}", struct_id);
590 let type_ctor: TypeCtor = from_chalk(db, struct_id); 590 let type_ctor: TypeCtor = from_chalk(db, struct_id);
591 debug!("struct {:?} = {:?}", struct_id, type_ctor); 591 debug!("struct {:?} = {:?}", struct_id, type_ctor);
@@ -617,7 +617,7 @@ pub(crate) fn impl_datum_query(
617 db: &impl HirDatabase, 617 db: &impl HirDatabase,
618 krate: Crate, 618 krate: Crate,
619 impl_id: ImplId, 619 impl_id: ImplId,
620) -> Arc<ImplDatum> { 620) -> Arc<ImplDatum<ChalkIr>> {
621 let _p = ra_prof::profile("impl_datum"); 621 let _p = ra_prof::profile("impl_datum");
622 debug!("impl_datum {:?}", impl_id); 622 debug!("impl_datum {:?}", impl_id);
623 let impl_: Impl = from_chalk(db, impl_id); 623 let impl_: Impl = from_chalk(db, impl_id);
@@ -633,7 +633,7 @@ fn impl_block_datum(
633 krate: Crate, 633 krate: Crate,
634 impl_id: ImplId, 634 impl_id: ImplId,
635 impl_block: ImplBlock, 635 impl_block: ImplBlock,
636) -> Option<Arc<ImplDatum>> { 636) -> Option<Arc<ImplDatum<ChalkIr>>> {
637 let generic_params = impl_block.generic_params(db); 637 let generic_params = impl_block.generic_params(db);
638 let bound_vars = Substs::bound_vars(&generic_params); 638 let bound_vars = Substs::bound_vars(&generic_params);
639 let trait_ref = impl_block.target_trait_ref(db)?.subst(&bound_vars); 639 let trait_ref = impl_block.target_trait_ref(db)?.subst(&bound_vars);
@@ -684,7 +684,7 @@ fn impl_block_datum(
684 Some(Arc::new(impl_datum)) 684 Some(Arc::new(impl_datum))
685} 685}
686 686
687fn invalid_impl_datum() -> Arc<ImplDatum> { 687fn invalid_impl_datum() -> Arc<ImplDatum<ChalkIr>> {
688 let trait_ref = chalk_ir::TraitRef { 688 let trait_ref = chalk_ir::TraitRef {
689 trait_id: UNKNOWN_TRAIT, 689 trait_id: UNKNOWN_TRAIT,
690 parameters: vec![chalk_ir::TyData::BoundVar(0).cast().intern().cast()], 690 parameters: vec![chalk_ir::TyData::BoundVar(0).cast().intern().cast()],
@@ -703,7 +703,7 @@ fn closure_fn_trait_impl_datum(
703 db: &impl HirDatabase, 703 db: &impl HirDatabase,
704 krate: Crate, 704 krate: Crate,
705 data: super::ClosureFnTraitImplData, 705 data: super::ClosureFnTraitImplData,
706) -> Option<Arc<ImplDatum>> { 706) -> Option<Arc<ImplDatum<ChalkIr>>> {
707 // for some closure |X, Y| -> Z: 707 // for some closure |X, Y| -> Z:
708 // impl<T, U, V> Fn<(T, U)> for closure<fn(T, U) -> V> { Output = V } 708 // impl<T, U, V> Fn<(T, U)> for closure<fn(T, U) -> V> { Output = V }
709 709
@@ -760,7 +760,7 @@ pub(crate) fn associated_ty_value_query(
760 db: &impl HirDatabase, 760 db: &impl HirDatabase,
761 krate: Crate, 761 krate: Crate,
762 id: chalk_rust_ir::AssociatedTyValueId, 762 id: chalk_rust_ir::AssociatedTyValueId,
763) -> Arc<chalk_rust_ir::AssociatedTyValue> { 763) -> Arc<chalk_rust_ir::AssociatedTyValue<ChalkIr>> {
764 let data: AssocTyValue = from_chalk(db, id); 764 let data: AssocTyValue = from_chalk(db, id);
765 match data { 765 match data {
766 AssocTyValue::TypeAlias(type_alias) => { 766 AssocTyValue::TypeAlias(type_alias) => {
@@ -776,7 +776,7 @@ fn type_alias_associated_ty_value(
776 db: &impl HirDatabase, 776 db: &impl HirDatabase,
777 _krate: Crate, 777 _krate: Crate,
778 type_alias: TypeAlias, 778 type_alias: TypeAlias,
779) -> Arc<AssociatedTyValue> { 779) -> Arc<AssociatedTyValue<ChalkIr>> {
780 let impl_block = type_alias.impl_block(db).expect("assoc ty value should be in impl"); 780 let impl_block = type_alias.impl_block(db).expect("assoc ty value should be in impl");
781 let impl_id = Impl::ImplBlock(impl_block).to_chalk(db); 781 let impl_id = Impl::ImplBlock(impl_block).to_chalk(db);
782 let trait_ = impl_block 782 let trait_ = impl_block
@@ -802,7 +802,7 @@ fn closure_fn_trait_output_assoc_ty_value(
802 db: &impl HirDatabase, 802 db: &impl HirDatabase,
803 krate: Crate, 803 krate: Crate,
804 data: super::ClosureFnTraitImplData, 804 data: super::ClosureFnTraitImplData,
805) -> Arc<AssociatedTyValue> { 805) -> Arc<AssociatedTyValue<ChalkIr>> {
806 let impl_id = Impl::ClosureFnTraitImpl(data.clone()).to_chalk(db); 806 let impl_id = Impl::ClosureFnTraitImpl(data.clone()).to_chalk(db);
807 807
808 let num_args: u16 = match &data.def.body(db)[data.expr] { 808 let num_args: u16 = match &data.def.body(db)[data.expr] {