aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock56
-rw-r--r--crates/ra_hir_ty/Cargo.toml7
-rw-r--r--crates/ra_hir_ty/src/db.rs35
-rw-r--r--crates/ra_hir_ty/src/traits.rs6
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs180
5 files changed, 131 insertions, 153 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 55afcda7b..7b19a06dc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -128,7 +128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
128[[package]] 128[[package]]
129name = "chalk-derive" 129name = "chalk-derive"
130version = "0.1.0" 130version = "0.1.0"
131source = "git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb#151949dece8117d180b5d197a7afa968c3ba14bb" 131source = "git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5#ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5"
132dependencies = [ 132dependencies = [
133 "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 133 "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
134 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 134 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -138,27 +138,27 @@ dependencies = [
138[[package]] 138[[package]]
139name = "chalk-engine" 139name = "chalk-engine"
140version = "0.9.0" 140version = "0.9.0"
141source = "git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb#151949dece8117d180b5d197a7afa968c3ba14bb" 141source = "git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5#ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5"
142dependencies = [ 142dependencies = [
143 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 143 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
144 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 144 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
145] 145]
146 146
147[[package]] 147[[package]]
148name = "chalk-ir" 148name = "chalk-ir"
149version = "0.1.0" 149version = "0.1.0"
150source = "git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb#151949dece8117d180b5d197a7afa968c3ba14bb" 150source = "git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5#ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5"
151dependencies = [ 151dependencies = [
152 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 152 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
153 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 153 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
154 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 154 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
155 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", 155 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
156] 156]
157 157
158[[package]] 158[[package]]
159name = "chalk-macros" 159name = "chalk-macros"
160version = "0.1.1" 160version = "0.1.1"
161source = "git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb#151949dece8117d180b5d197a7afa968c3ba14bb" 161source = "git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5#ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5"
162dependencies = [ 162dependencies = [
163 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 163 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
164] 164]
@@ -166,24 +166,24 @@ dependencies = [
166[[package]] 166[[package]]
167name = "chalk-rust-ir" 167name = "chalk-rust-ir"
168version = "0.1.0" 168version = "0.1.0"
169source = "git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb#151949dece8117d180b5d197a7afa968c3ba14bb" 169source = "git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5#ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5"
170dependencies = [ 170dependencies = [
171 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 171 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
172 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 172 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
173 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 173 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
174 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 174 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
175] 175]
176 176
177[[package]] 177[[package]]
178name = "chalk-solve" 178name = "chalk-solve"
179version = "0.1.0" 179version = "0.1.0"
180source = "git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb#151949dece8117d180b5d197a7afa968c3ba14bb" 180source = "git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5#ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5"
181dependencies = [ 181dependencies = [
182 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 182 "chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
183 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 183 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
184 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 184 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
185 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 185 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
186 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 186 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
187 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", 187 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
188 "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", 188 "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
189 "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", 189 "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -995,9 +995,9 @@ name = "ra_hir_ty"
995version = "0.1.0" 995version = "0.1.0"
996dependencies = [ 996dependencies = [
997 "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 997 "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
998 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 998 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
999 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 999 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
1000 "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)", 1000 "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)",
1001 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", 1001 "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
1002 "insta 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 1002 "insta 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
1003 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", 1003 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1782,12 +1782,12 @@ dependencies = [
1782"checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" 1782"checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202"
1783"checksum cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76" 1783"checksum cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76"
1784"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 1784"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
1785"checksum chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)" = "<none>" 1785"checksum chalk-derive 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)" = "<none>"
1786"checksum chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)" = "<none>" 1786"checksum chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)" = "<none>"
1787"checksum chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)" = "<none>" 1787"checksum chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)" = "<none>"
1788"checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)" = "<none>" 1788"checksum chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)" = "<none>"
1789"checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)" = "<none>" 1789"checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)" = "<none>"
1790"checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=151949dece8117d180b5d197a7afa968c3ba14bb)" = "<none>" 1790"checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git?rev=ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5)" = "<none>"
1791"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" 1791"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
1792"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 1792"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
1793"checksum console 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f5d540c2d34ac9dd0deb5f3b5f54c36c79efa78f6b3ad19106a554d07a7b5d9f" 1793"checksum console 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f5d540c2d34ac9dd0deb5f3b5f54c36c79efa78f6b3ad19106a554d07a7b5d9f"
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml
index d277bf2bc..60793db44 100644
--- a/crates/ra_hir_ty/Cargo.toml
+++ b/crates/ra_hir_ty/Cargo.toml
@@ -21,10 +21,9 @@ ra_prof = { path = "../ra_prof" }
21ra_syntax = { path = "../ra_syntax" } 21ra_syntax = { path = "../ra_syntax" }
22test_utils = { path = "../test_utils" } 22test_utils = { path = "../test_utils" }
23 23
24# https://github.com/rust-lang/chalk/pull/294 24chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5" }
25chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "151949dece8117d180b5d197a7afa968c3ba14bb" } 25chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5" }
26chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "151949dece8117d180b5d197a7afa968c3ba14bb" } 26chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ff65b5ac9860f3c36bd892c865ab23d5ff0bbae5" }
27chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "151949dece8117d180b5d197a7afa968c3ba14bb" }
28 27
29lalrpop-intern = "0.15.1" 28lalrpop-intern = "0.15.1"
30 29
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index 222a36a9f..d52f65b83 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -10,7 +10,7 @@ use ra_db::{salsa, CrateId};
10 10
11use crate::{ 11use crate::{
12 method_resolution::CrateImplBlocks, 12 method_resolution::CrateImplBlocks,
13 traits::{AssocTyValue, Impl}, 13 traits::{chalk, AssocTyValue, Impl},
14 CallableDef, FnSig, GenericPredicate, InferenceResult, Substs, TraitRef, Ty, TyDefId, TypeCtor, 14 CallableDef, FnSig, GenericPredicate, InferenceResult, Substs, TraitRef, Ty, TyDefId, TypeCtor,
15 ValueTyDefId, 15 ValueTyDefId,
16}; 16};
@@ -77,39 +77,24 @@ pub trait HirDatabase: DefDatabase {
77 #[salsa::interned] 77 #[salsa::interned]
78 fn intern_assoc_ty_value(&self, assoc_ty_value: AssocTyValue) -> crate::traits::AssocTyValueId; 78 fn intern_assoc_ty_value(&self, assoc_ty_value: AssocTyValue) -> crate::traits::AssocTyValueId;
79 79
80 #[salsa::invoke(crate::traits::chalk::associated_ty_data_query)] 80 #[salsa::invoke(chalk::associated_ty_data_query)]
81 fn associated_ty_data( 81 fn associated_ty_data(&self, id: chalk::AssocTypeId) -> Arc<chalk::AssociatedTyDatum>;
82 &self,
83 id: chalk_ir::TypeId,
84 ) -> Arc<chalk_rust_ir::AssociatedTyDatum<chalk_ir::family::ChalkIr>>;
85 82
86 #[salsa::invoke(crate::traits::chalk::trait_datum_query)] 83 #[salsa::invoke(chalk::trait_datum_query)]
87 fn trait_datum( 84 fn trait_datum(&self, krate: CrateId, trait_id: chalk::TraitId) -> Arc<chalk::TraitDatum>;
88 &self,
89 krate: CrateId,
90 trait_id: chalk_ir::TraitId,
91 ) -> Arc<chalk_rust_ir::TraitDatum<chalk_ir::family::ChalkIr>>;
92 85
93 #[salsa::invoke(crate::traits::chalk::struct_datum_query)] 86 #[salsa::invoke(chalk::struct_datum_query)]
94 fn struct_datum( 87 fn struct_datum(&self, krate: CrateId, struct_id: chalk::StructId) -> Arc<chalk::StructDatum>;
95 &self,
96 krate: CrateId,
97 struct_id: chalk_ir::StructId,
98 ) -> Arc<chalk_rust_ir::StructDatum<chalk_ir::family::ChalkIr>>;
99 88
100 #[salsa::invoke(crate::traits::chalk::impl_datum_query)] 89 #[salsa::invoke(crate::traits::chalk::impl_datum_query)]
101 fn impl_datum( 90 fn impl_datum(&self, krate: CrateId, impl_id: chalk::ImplId) -> Arc<chalk::ImplDatum>;
102 &self,
103 krate: CrateId,
104 impl_id: chalk_ir::ImplId,
105 ) -> Arc<chalk_rust_ir::ImplDatum<chalk_ir::family::ChalkIr>>;
106 91
107 #[salsa::invoke(crate::traits::chalk::associated_ty_value_query)] 92 #[salsa::invoke(crate::traits::chalk::associated_ty_value_query)]
108 fn associated_ty_value( 93 fn associated_ty_value(
109 &self, 94 &self,
110 krate: CrateId, 95 krate: CrateId,
111 id: chalk_rust_ir::AssociatedTyValueId, 96 id: chalk::AssociatedTyValueId,
112 ) -> Arc<chalk_rust_ir::AssociatedTyValue<chalk_ir::family::ChalkIr>>; 97 ) -> Arc<chalk::AssociatedTyValue>;
113 98
114 #[salsa::invoke(crate::traits::trait_solve_query)] 99 #[salsa::invoke(crate::traits::trait_solve_query)]
115 fn trait_solve( 100 fn trait_solve(
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs
index d49f8fb4b..46e17f0b8 100644
--- a/crates/ra_hir_ty/src/traits.rs
+++ b/crates/ra_hir_ty/src/traits.rs
@@ -209,9 +209,9 @@ fn solution_from_chalk(
209 .parameters 209 .parameters
210 .into_iter() 210 .into_iter()
211 .map(|p| { 211 .map(|p| {
212 let ty = match p { 212 let ty = match p.ty() {
213 chalk_ir::Parameter(chalk_ir::ParameterKind::Ty(ty)) => from_chalk(db, ty), 213 Some(ty) => from_chalk(db, ty.clone()),
214 chalk_ir::Parameter(chalk_ir::ParameterKind::Lifetime(_)) => unimplemented!(), 214 None => unimplemented!(),
215 }; 215 };
216 ty 216 ty
217 }) 217 })
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index 5eb032d86..3a91a374d 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -3,15 +3,9 @@ use std::sync::Arc;
3 3
4use log::debug; 4use log::debug;
5 5
6use chalk_ir::{ 6use chalk_ir::{cast::Cast, family::ChalkIr, Parameter, PlaceholderIndex, TypeName, UniverseIndex};
7 cast::Cast, family::ChalkIr, Identifier, Parameter, PlaceholderIndex, TypeId, TypeKindId,
8 TypeName, UniverseIndex,
9};
10use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum};
11 7
12use hir_def::{ 8use hir_def::{AssocContainerId, AssocItemId, GenericDefId, HasModule, Lookup, TypeAliasId};
13 AssocContainerId, AssocItemId, GenericDefId, HasModule, ImplId, Lookup, TraitId, TypeAliasId,
14};
15use ra_db::{ 9use ra_db::{
16 salsa::{InternId, InternKey}, 10 salsa::{InternId, InternKey},
17 CrateId, 11 CrateId,
@@ -23,9 +17,20 @@ use crate::{
23 ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, 17 ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk,
24}; 18};
25 19
20pub type TypeFamily = chalk_ir::family::ChalkIr; // TODO use everywhere
21pub type AssocTypeId = chalk_ir::AssocTypeId<TypeFamily>;
22pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<TypeFamily>;
23pub type TraitId = chalk_ir::TraitId<TypeFamily>;
24pub type TraitDatum = chalk_rust_ir::TraitDatum<TypeFamily>;
25pub type StructId = chalk_ir::StructId<TypeFamily>;
26pub type StructDatum = chalk_rust_ir::StructDatum<TypeFamily>;
27pub type ImplId = chalk_ir::ImplId<TypeFamily>;
28pub type ImplDatum = chalk_rust_ir::ImplDatum<TypeFamily>;
29pub type AssociatedTyValueId = chalk_rust_ir::AssociatedTyValueId;
30pub type AssociatedTyValue = chalk_rust_ir::AssociatedTyValue<TypeFamily>;
31
26/// This represents a trait whose name we could not resolve. 32/// This represents a trait whose name we could not resolve.
27const UNKNOWN_TRAIT: chalk_ir::TraitId = 33const UNKNOWN_TRAIT: TraitId = chalk_ir::TraitId(chalk_ir::RawId { index: u32::max_value() });
28 chalk_ir::TraitId(chalk_ir::RawId { index: u32::max_value() });
29 34
30pub(super) trait ToChalk { 35pub(super) trait ToChalk {
31 type Chalk; 36 type Chalk;
@@ -53,7 +58,7 @@ impl ToChalk for Ty {
53 _ => { 58 _ => {
54 // other TypeCtors get interned and turned into a chalk StructId 59 // other TypeCtors get interned and turned into a chalk StructId
55 let struct_id = apply_ty.ctor.to_chalk(db); 60 let struct_id = apply_ty.ctor.to_chalk(db);
56 TypeName::TypeKindId(struct_id.into()) 61 TypeName::Struct(struct_id.into())
57 } 62 }
58 }; 63 };
59 let parameters = apply_ty.parameters.to_chalk(db); 64 let parameters = apply_ty.parameters.to_chalk(db);
@@ -71,11 +76,13 @@ impl ToChalk for Ty {
71 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), 76 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"),
72 Ty::Dyn(predicates) => { 77 Ty::Dyn(predicates) => {
73 let where_clauses = predicates.iter().cloned().map(|p| p.to_chalk(db)).collect(); 78 let where_clauses = predicates.iter().cloned().map(|p| p.to_chalk(db)).collect();
74 chalk_ir::TyData::Dyn(make_binders(where_clauses, 1)).intern() 79 let bounded_ty = chalk_ir::BoundedTy { bounds: make_binders(where_clauses, 1) };
80 chalk_ir::TyData::Dyn(bounded_ty).intern()
75 } 81 }
76 Ty::Opaque(predicates) => { 82 Ty::Opaque(predicates) => {
77 let where_clauses = predicates.iter().cloned().map(|p| p.to_chalk(db)).collect(); 83 let where_clauses = predicates.iter().cloned().map(|p| p.to_chalk(db)).collect();
78 chalk_ir::TyData::Opaque(make_binders(where_clauses, 1)).intern() 84 let bounded_ty = chalk_ir::BoundedTy { bounds: make_binders(where_clauses, 1) };
85 chalk_ir::TyData::Opaque(bounded_ty).intern()
79 } 86 }
80 Ty::Unknown => { 87 Ty::Unknown => {
81 let parameters = Vec::new(); 88 let parameters = Vec::new();
@@ -87,10 +94,9 @@ impl ToChalk for Ty {
87 fn from_chalk(db: &impl HirDatabase, chalk: chalk_ir::Ty<ChalkIr>) -> Self { 94 fn from_chalk(db: &impl HirDatabase, chalk: chalk_ir::Ty<ChalkIr>) -> Self {
88 match chalk.data().clone() { 95 match chalk.data().clone() {
89 chalk_ir::TyData::Apply(apply_ty) => { 96 chalk_ir::TyData::Apply(apply_ty) => {
90 // FIXME this is kind of hacky due to the fact that 97 // TODO clean this up now that Placeholder isn't in TypeName anymore
91 // TypeName::Placeholder is a Ty::Param on our side
92 match apply_ty.name { 98 match apply_ty.name {
93 TypeName::TypeKindId(TypeKindId::StructId(struct_id)) => { 99 TypeName::Struct(struct_id) => {
94 let ctor = from_chalk(db, struct_id); 100 let ctor = from_chalk(db, struct_id);
95 let parameters = from_chalk(db, apply_ty.parameters); 101 let parameters = from_chalk(db, apply_ty.parameters);
96 Ty::Apply(ApplicationTy { ctor, parameters }) 102 Ty::Apply(ApplicationTy { ctor, parameters })
@@ -101,14 +107,12 @@ impl ToChalk for Ty {
101 Ty::Apply(ApplicationTy { ctor, parameters }) 107 Ty::Apply(ApplicationTy { ctor, parameters })
102 } 108 }
103 TypeName::Error => Ty::Unknown, 109 TypeName::Error => Ty::Unknown,
104 // FIXME handle TypeKindId::Trait/Type here
105 TypeName::TypeKindId(_) => unimplemented!(),
106 TypeName::Placeholder(idx) => {
107 assert_eq!(idx.ui, UniverseIndex::ROOT);
108 Ty::Param { idx: idx.idx as u32, name: crate::Name::missing() }
109 }
110 } 110 }
111 } 111 }
112 chalk_ir::TyData::Placeholder(idx) => {
113 assert_eq!(idx.ui, UniverseIndex::ROOT);
114 Ty::Param { idx: idx.idx as u32, name: crate::Name::missing() }
115 }
112 chalk_ir::TyData::Projection(proj) => { 116 chalk_ir::TyData::Projection(proj) => {
113 let associated_ty = from_chalk(db, proj.associated_ty_id); 117 let associated_ty = from_chalk(db, proj.associated_ty_id);
114 let parameters = from_chalk(db, proj.parameters); 118 let parameters = from_chalk(db, proj.parameters);
@@ -118,15 +122,15 @@ impl ToChalk for Ty {
118 chalk_ir::TyData::BoundVar(idx) => Ty::Bound(idx as u32), 122 chalk_ir::TyData::BoundVar(idx) => Ty::Bound(idx as u32),
119 chalk_ir::TyData::InferenceVar(_iv) => Ty::Unknown, 123 chalk_ir::TyData::InferenceVar(_iv) => Ty::Unknown,
120 chalk_ir::TyData::Dyn(where_clauses) => { 124 chalk_ir::TyData::Dyn(where_clauses) => {
121 assert_eq!(where_clauses.binders.len(), 1); 125 assert_eq!(where_clauses.bounds.binders.len(), 1);
122 let predicates = 126 let predicates =
123 where_clauses.value.into_iter().map(|c| from_chalk(db, c)).collect(); 127 where_clauses.bounds.value.into_iter().map(|c| from_chalk(db, c)).collect();
124 Ty::Dyn(predicates) 128 Ty::Dyn(predicates)
125 } 129 }
126 chalk_ir::TyData::Opaque(where_clauses) => { 130 chalk_ir::TyData::Opaque(where_clauses) => {
127 assert_eq!(where_clauses.binders.len(), 1); 131 assert_eq!(where_clauses.bounds.binders.len(), 1);
128 let predicates = 132 let predicates =
129 where_clauses.value.into_iter().map(|c| from_chalk(db, c)).collect(); 133 where_clauses.bounds.value.into_iter().map(|c| from_chalk(db, c)).collect();
130 Ty::Opaque(predicates) 134 Ty::Opaque(predicates)
131 } 135 }
132 } 136 }
@@ -143,9 +147,9 @@ impl ToChalk for Substs {
143 fn from_chalk(db: &impl HirDatabase, parameters: Vec<chalk_ir::Parameter<ChalkIr>>) -> Substs { 147 fn from_chalk(db: &impl HirDatabase, parameters: Vec<chalk_ir::Parameter<ChalkIr>>) -> Substs {
144 let tys = parameters 148 let tys = parameters
145 .into_iter() 149 .into_iter()
146 .map(|p| match p { 150 .map(|p| match p.ty() {
147 chalk_ir::Parameter(chalk_ir::ParameterKind::Ty(ty)) => from_chalk(db, ty), 151 Some(ty) => from_chalk(db, ty.clone()),
148 chalk_ir::Parameter(chalk_ir::ParameterKind::Lifetime(_)) => unimplemented!(), 152 None => unimplemented!(),
149 }) 153 })
150 .collect(); 154 .collect();
151 Substs(tys) 155 Substs(tys)
@@ -168,65 +172,62 @@ impl ToChalk for TraitRef {
168 } 172 }
169} 173}
170 174
171impl ToChalk for TraitId { 175impl ToChalk for hir_def::TraitId {
172 type Chalk = chalk_ir::TraitId; 176 type Chalk = TraitId;
173 177
174 fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TraitId { 178 fn to_chalk(self, _db: &impl HirDatabase) -> TraitId {
175 chalk_ir::TraitId(id_to_chalk(self)) 179 chalk_ir::TraitId(id_to_chalk(self))
176 } 180 }
177 181
178 fn from_chalk(_db: &impl HirDatabase, trait_id: chalk_ir::TraitId) -> TraitId { 182 fn from_chalk(_db: &impl HirDatabase, trait_id: TraitId) -> hir_def::TraitId {
179 id_from_chalk(trait_id.0) 183 id_from_chalk(trait_id.0)
180 } 184 }
181} 185}
182 186
183impl ToChalk for TypeCtor { 187impl ToChalk for TypeCtor {
184 type Chalk = chalk_ir::StructId; 188 type Chalk = StructId;
185 189
186 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::StructId { 190 fn to_chalk(self, db: &impl HirDatabase) -> StructId {
187 db.intern_type_ctor(self).into() 191 db.intern_type_ctor(self).into()
188 } 192 }
189 193
190 fn from_chalk(db: &impl HirDatabase, struct_id: chalk_ir::StructId) -> TypeCtor { 194 fn from_chalk(db: &impl HirDatabase, struct_id: StructId) -> TypeCtor {
191 db.lookup_intern_type_ctor(struct_id.into()) 195 db.lookup_intern_type_ctor(struct_id.into())
192 } 196 }
193} 197}
194 198
195impl ToChalk for Impl { 199impl ToChalk for Impl {
196 type Chalk = chalk_ir::ImplId; 200 type Chalk = ImplId;
197 201
198 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::ImplId { 202 fn to_chalk(self, db: &impl HirDatabase) -> ImplId {
199 db.intern_chalk_impl(self).into() 203 db.intern_chalk_impl(self).into()
200 } 204 }
201 205
202 fn from_chalk(db: &impl HirDatabase, impl_id: chalk_ir::ImplId) -> Impl { 206 fn from_chalk(db: &impl HirDatabase, impl_id: ImplId) -> Impl {
203 db.lookup_intern_chalk_impl(impl_id.into()) 207 db.lookup_intern_chalk_impl(impl_id.into())
204 } 208 }
205} 209}
206 210
207impl ToChalk for TypeAliasId { 211impl ToChalk for TypeAliasId {
208 type Chalk = chalk_ir::TypeId; 212 type Chalk = AssocTypeId;
209 213
210 fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TypeId { 214 fn to_chalk(self, _db: &impl HirDatabase) -> AssocTypeId {
211 chalk_ir::TypeId(id_to_chalk(self)) 215 chalk_ir::AssocTypeId(id_to_chalk(self))
212 } 216 }
213 217
214 fn from_chalk(_db: &impl HirDatabase, type_alias_id: chalk_ir::TypeId) -> TypeAliasId { 218 fn from_chalk(_db: &impl HirDatabase, type_alias_id: AssocTypeId) -> TypeAliasId {
215 id_from_chalk(type_alias_id.0) 219 id_from_chalk(type_alias_id.0)
216 } 220 }
217} 221}
218 222
219impl ToChalk for AssocTyValue { 223impl ToChalk for AssocTyValue {
220 type Chalk = chalk_rust_ir::AssociatedTyValueId; 224 type Chalk = AssociatedTyValueId;
221 225
222 fn to_chalk(self, db: &impl HirDatabase) -> chalk_rust_ir::AssociatedTyValueId { 226 fn to_chalk(self, db: &impl HirDatabase) -> AssociatedTyValueId {
223 db.intern_assoc_ty_value(self).into() 227 db.intern_assoc_ty_value(self).into()
224 } 228 }
225 229
226 fn from_chalk( 230 fn from_chalk(db: &impl HirDatabase, assoc_ty_value_id: AssociatedTyValueId) -> AssocTyValue {
227 db: &impl HirDatabase,
228 assoc_ty_value_id: chalk_rust_ir::AssociatedTyValueId,
229 ) -> AssocTyValue {
230 db.lookup_intern_assoc_ty_value(assoc_ty_value_id.into()) 231 db.lookup_intern_assoc_ty_value(assoc_ty_value_id.into())
231 } 232 }
232} 233}
@@ -468,28 +469,28 @@ impl<'a, DB> chalk_solve::RustIrDatabase<ChalkIr> for ChalkContext<'a, DB>
468where 469where
469 DB: HirDatabase, 470 DB: HirDatabase,
470{ 471{
471 fn associated_ty_data(&self, id: TypeId) -> Arc<AssociatedTyDatum<ChalkIr>> { 472 fn associated_ty_data(&self, id: AssocTypeId) -> Arc<AssociatedTyDatum> {
472 self.db.associated_ty_data(id) 473 self.db.associated_ty_data(id)
473 } 474 }
474 fn trait_datum(&self, trait_id: chalk_ir::TraitId) -> Arc<TraitDatum<ChalkIr>> { 475 fn trait_datum(&self, trait_id: TraitId) -> Arc<TraitDatum> {
475 self.db.trait_datum(self.krate, trait_id) 476 self.db.trait_datum(self.krate, trait_id)
476 } 477 }
477 fn struct_datum(&self, struct_id: chalk_ir::StructId) -> Arc<StructDatum<ChalkIr>> { 478 fn struct_datum(&self, struct_id: StructId) -> Arc<StructDatum> {
478 self.db.struct_datum(self.krate, struct_id) 479 self.db.struct_datum(self.krate, struct_id)
479 } 480 }
480 fn impl_datum(&self, impl_id: chalk_ir::ImplId) -> Arc<ImplDatum<ChalkIr>> { 481 fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum> {
481 self.db.impl_datum(self.krate, impl_id) 482 self.db.impl_datum(self.krate, impl_id)
482 } 483 }
483 fn impls_for_trait( 484 fn impls_for_trait(
484 &self, 485 &self,
485 trait_id: chalk_ir::TraitId, 486 trait_id: TraitId,
486 parameters: &[Parameter<ChalkIr>], 487 parameters: &[Parameter<TypeFamily>],
487 ) -> Vec<chalk_ir::ImplId> { 488 ) -> Vec<ImplId> {
488 debug!("impls_for_trait {:?}", trait_id); 489 debug!("impls_for_trait {:?}", trait_id);
489 if trait_id == UNKNOWN_TRAIT { 490 if trait_id == UNKNOWN_TRAIT {
490 return Vec::new(); 491 return Vec::new();
491 } 492 }
492 let trait_: TraitId = from_chalk(self.db, trait_id); 493 let trait_: hir_def::TraitId = from_chalk(self.db, trait_id);
493 let mut result: Vec<_> = self 494 let mut result: Vec<_> = self
494 .db 495 .db
495 .impls_for_trait(self.krate, trait_.into()) 496 .impls_for_trait(self.krate, trait_.into())
@@ -508,39 +509,32 @@ where
508 debug!("impls_for_trait returned {} impls", result.len()); 509 debug!("impls_for_trait returned {} impls", result.len());
509 result 510 result
510 } 511 }
511 fn impl_provided_for( 512 fn impl_provided_for(&self, auto_trait_id: TraitId, struct_id: StructId) -> bool {
512 &self,
513 auto_trait_id: chalk_ir::TraitId,
514 struct_id: chalk_ir::StructId,
515 ) -> bool {
516 debug!("impl_provided_for {:?}, {:?}", auto_trait_id, struct_id); 513 debug!("impl_provided_for {:?}, {:?}", auto_trait_id, struct_id);
517 false // FIXME 514 false // FIXME
518 } 515 }
519 fn type_name(&self, _id: TypeKindId) -> Identifier { 516 fn associated_ty_value(&self, id: AssociatedTyValueId) -> Arc<AssociatedTyValue> {
520 unimplemented!()
521 }
522 fn associated_ty_value(
523 &self,
524 id: chalk_rust_ir::AssociatedTyValueId,
525 ) -> Arc<AssociatedTyValue<ChalkIr>> {
526 self.db.associated_ty_value(self.krate.into(), id) 517 self.db.associated_ty_value(self.krate.into(), id)
527 } 518 }
528 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<ChalkIr>> { 519 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<ChalkIr>> {
529 vec![] 520 vec![]
530 } 521 }
531 fn local_impls_to_coherence_check( 522 fn local_impls_to_coherence_check(&self, _trait_id: TraitId) -> Vec<ImplId> {
532 &self,
533 _trait_id: chalk_ir::TraitId,
534 ) -> Vec<chalk_ir::ImplId> {
535 // We don't do coherence checking (yet) 523 // We don't do coherence checking (yet)
536 unimplemented!() 524 unimplemented!()
537 } 525 }
526 fn as_struct_id(&self, id: &TypeName<TypeFamily>) -> Option<StructId> {
527 match id {
528 TypeName::Struct(struct_id) => Some(*struct_id),
529 _ => None,
530 }
531 }
538} 532}
539 533
540pub(crate) fn associated_ty_data_query( 534pub(crate) fn associated_ty_data_query(
541 db: &impl HirDatabase, 535 db: &impl HirDatabase,
542 id: TypeId, 536 id: AssocTypeId,
543) -> Arc<AssociatedTyDatum<ChalkIr>> { 537) -> Arc<AssociatedTyDatum> {
544 debug!("associated_ty_data {:?}", id); 538 debug!("associated_ty_data {:?}", id);
545 let type_alias: TypeAliasId = from_chalk(db, id); 539 let type_alias: TypeAliasId = from_chalk(db, id);
546 let trait_ = match type_alias.lookup(db).container { 540 let trait_ = match type_alias.lookup(db).container {
@@ -565,8 +559,8 @@ pub(crate) fn associated_ty_data_query(
565pub(crate) fn trait_datum_query( 559pub(crate) fn trait_datum_query(
566 db: &impl HirDatabase, 560 db: &impl HirDatabase,
567 krate: CrateId, 561 krate: CrateId,
568 trait_id: chalk_ir::TraitId, 562 trait_id: TraitId,
569) -> Arc<TraitDatum<ChalkIr>> { 563) -> Arc<TraitDatum> {
570 debug!("trait_datum {:?}", trait_id); 564 debug!("trait_datum {:?}", trait_id);
571 if trait_id == UNKNOWN_TRAIT { 565 if trait_id == UNKNOWN_TRAIT {
572 let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses: Vec::new() }; 566 let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses: Vec::new() };
@@ -586,7 +580,7 @@ pub(crate) fn trait_datum_query(
586 associated_ty_ids: vec![], 580 associated_ty_ids: vec![],
587 }); 581 });
588 } 582 }
589 let trait_: TraitId = from_chalk(db, trait_id); 583 let trait_: hir_def::TraitId = from_chalk(db, trait_id);
590 let trait_data = db.trait_data(trait_); 584 let trait_data = db.trait_data(trait_);
591 debug!("trait {:?} = {:?}", trait_id, trait_data.name); 585 debug!("trait {:?} = {:?}", trait_id, trait_data.name);
592 let generic_params = generics(db, trait_.into()); 586 let generic_params = generics(db, trait_.into());
@@ -616,8 +610,8 @@ pub(crate) fn trait_datum_query(
616pub(crate) fn struct_datum_query( 610pub(crate) fn struct_datum_query(
617 db: &impl HirDatabase, 611 db: &impl HirDatabase,
618 krate: CrateId, 612 krate: CrateId,
619 struct_id: chalk_ir::StructId, 613 struct_id: StructId,
620) -> Arc<StructDatum<ChalkIr>> { 614) -> Arc<StructDatum> {
621 debug!("struct_datum {:?}", struct_id); 615 debug!("struct_datum {:?}", struct_id);
622 let type_ctor: TypeCtor = from_chalk(db, struct_id); 616 let type_ctor: TypeCtor = from_chalk(db, struct_id);
623 debug!("struct {:?} = {:?}", struct_id, type_ctor); 617 debug!("struct {:?} = {:?}", struct_id, type_ctor);
@@ -648,8 +642,8 @@ pub(crate) fn struct_datum_query(
648pub(crate) fn impl_datum_query( 642pub(crate) fn impl_datum_query(
649 db: &impl HirDatabase, 643 db: &impl HirDatabase,
650 krate: CrateId, 644 krate: CrateId,
651 impl_id: chalk_ir::ImplId, 645 impl_id: ImplId,
652) -> Arc<ImplDatum<ChalkIr>> { 646) -> Arc<ImplDatum> {
653 let _p = ra_prof::profile("impl_datum"); 647 let _p = ra_prof::profile("impl_datum");
654 debug!("impl_datum {:?}", impl_id); 648 debug!("impl_datum {:?}", impl_id);
655 let impl_: Impl = from_chalk(db, impl_id); 649 let impl_: Impl = from_chalk(db, impl_id);
@@ -663,9 +657,9 @@ pub(crate) fn impl_datum_query(
663fn impl_block_datum( 657fn impl_block_datum(
664 db: &impl HirDatabase, 658 db: &impl HirDatabase,
665 krate: CrateId, 659 krate: CrateId,
666 chalk_id: chalk_ir::ImplId, 660 chalk_id: ImplId,
667 impl_id: ImplId, 661 impl_id: hir_def::ImplId,
668) -> Option<Arc<ImplDatum<ChalkIr>>> { 662) -> Option<Arc<ImplDatum>> {
669 let trait_ref = db.impl_trait(impl_id)?; 663 let trait_ref = db.impl_trait(impl_id)?;
670 let impl_data = db.impl_data(impl_id); 664 let impl_data = db.impl_data(impl_id);
671 665
@@ -721,7 +715,7 @@ fn impl_block_datum(
721 Some(Arc::new(impl_datum)) 715 Some(Arc::new(impl_datum))
722} 716}
723 717
724fn invalid_impl_datum() -> Arc<ImplDatum<ChalkIr>> { 718fn invalid_impl_datum() -> Arc<ImplDatum> {
725 let trait_ref = chalk_ir::TraitRef { 719 let trait_ref = chalk_ir::TraitRef {
726 trait_id: UNKNOWN_TRAIT, 720 trait_id: UNKNOWN_TRAIT,
727 parameters: vec![chalk_ir::TyData::BoundVar(0).cast().intern().cast()], 721 parameters: vec![chalk_ir::TyData::BoundVar(0).cast().intern().cast()],
@@ -754,7 +748,7 @@ fn type_alias_associated_ty_value(
754 db: &impl HirDatabase, 748 db: &impl HirDatabase,
755 _krate: CrateId, 749 _krate: CrateId,
756 type_alias: TypeAliasId, 750 type_alias: TypeAliasId,
757) -> Arc<AssociatedTyValue<ChalkIr>> { 751) -> Arc<AssociatedTyValue> {
758 let type_alias_data = db.type_alias_data(type_alias); 752 let type_alias_data = db.type_alias_data(type_alias);
759 let impl_id = match type_alias.lookup(db).container { 753 let impl_id = match type_alias.lookup(db).container {
760 AssocContainerId::ImplId(it) => it, 754 AssocContainerId::ImplId(it) => it,
@@ -786,25 +780,25 @@ fn id_to_chalk<T: InternKey>(salsa_id: T) -> chalk_ir::RawId {
786 chalk_ir::RawId { index: salsa_id.as_intern_id().as_u32() } 780 chalk_ir::RawId { index: salsa_id.as_intern_id().as_u32() }
787} 781}
788 782
789impl From<chalk_ir::StructId> for crate::TypeCtorId { 783impl From<StructId> for crate::TypeCtorId {
790 fn from(struct_id: chalk_ir::StructId) -> Self { 784 fn from(struct_id: StructId) -> Self {
791 id_from_chalk(struct_id.0) 785 id_from_chalk(struct_id.0)
792 } 786 }
793} 787}
794 788
795impl From<crate::TypeCtorId> for chalk_ir::StructId { 789impl From<crate::TypeCtorId> for StructId {
796 fn from(type_ctor_id: crate::TypeCtorId) -> Self { 790 fn from(type_ctor_id: crate::TypeCtorId) -> Self {
797 chalk_ir::StructId(id_to_chalk(type_ctor_id)) 791 chalk_ir::StructId(id_to_chalk(type_ctor_id))
798 } 792 }
799} 793}
800 794
801impl From<chalk_ir::ImplId> for crate::traits::GlobalImplId { 795impl From<ImplId> for crate::traits::GlobalImplId {
802 fn from(impl_id: chalk_ir::ImplId) -> Self { 796 fn from(impl_id: ImplId) -> Self {
803 id_from_chalk(impl_id.0) 797 id_from_chalk(impl_id.0)
804 } 798 }
805} 799}
806 800
807impl From<crate::traits::GlobalImplId> for chalk_ir::ImplId { 801impl From<crate::traits::GlobalImplId> for ImplId {
808 fn from(impl_id: crate::traits::GlobalImplId) -> Self { 802 fn from(impl_id: crate::traits::GlobalImplId) -> Self {
809 chalk_ir::ImplId(id_to_chalk(impl_id)) 803 chalk_ir::ImplId(id_to_chalk(impl_id))
810 } 804 }