diff options
-rw-r--r-- | Cargo.lock | 24 | ||||
-rw-r--r-- | crates/ra_hir_ty/Cargo.toml | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 57 |
3 files changed, 53 insertions, 34 deletions
diff --git a/Cargo.lock b/Cargo.lock index f94cea814..4412b0708 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -113,8 +113,8 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | |||
113 | 113 | ||
114 | [[package]] | 114 | [[package]] |
115 | name = "chalk-derive" | 115 | name = "chalk-derive" |
116 | version = "0.1.0" | 116 | version = "0.10.1-dev" |
117 | source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282" | 117 | source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3" |
118 | dependencies = [ | 118 | dependencies = [ |
119 | "proc-macro2", | 119 | "proc-macro2", |
120 | "quote", | 120 | "quote", |
@@ -124,8 +124,8 @@ dependencies = [ | |||
124 | 124 | ||
125 | [[package]] | 125 | [[package]] |
126 | name = "chalk-engine" | 126 | name = "chalk-engine" |
127 | version = "0.9.0" | 127 | version = "0.10.1-dev" |
128 | source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282" | 128 | source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3" |
129 | dependencies = [ | 129 | dependencies = [ |
130 | "chalk-macros", | 130 | "chalk-macros", |
131 | "rustc-hash", | 131 | "rustc-hash", |
@@ -133,8 +133,8 @@ dependencies = [ | |||
133 | 133 | ||
134 | [[package]] | 134 | [[package]] |
135 | name = "chalk-ir" | 135 | name = "chalk-ir" |
136 | version = "0.1.0" | 136 | version = "0.10.1-dev" |
137 | source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282" | 137 | source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3" |
138 | dependencies = [ | 138 | dependencies = [ |
139 | "chalk-derive", | 139 | "chalk-derive", |
140 | "chalk-engine", | 140 | "chalk-engine", |
@@ -143,16 +143,16 @@ dependencies = [ | |||
143 | 143 | ||
144 | [[package]] | 144 | [[package]] |
145 | name = "chalk-macros" | 145 | name = "chalk-macros" |
146 | version = "0.1.1" | 146 | version = "0.10.1-dev" |
147 | source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282" | 147 | source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3" |
148 | dependencies = [ | 148 | dependencies = [ |
149 | "lazy_static", | 149 | "lazy_static", |
150 | ] | 150 | ] |
151 | 151 | ||
152 | [[package]] | 152 | [[package]] |
153 | name = "chalk-rust-ir" | 153 | name = "chalk-rust-ir" |
154 | version = "0.1.0" | 154 | version = "0.10.1-dev" |
155 | source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282" | 155 | source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3" |
156 | dependencies = [ | 156 | dependencies = [ |
157 | "chalk-derive", | 157 | "chalk-derive", |
158 | "chalk-engine", | 158 | "chalk-engine", |
@@ -162,8 +162,8 @@ dependencies = [ | |||
162 | 162 | ||
163 | [[package]] | 163 | [[package]] |
164 | name = "chalk-solve" | 164 | name = "chalk-solve" |
165 | version = "0.1.0" | 165 | version = "0.10.1-dev" |
166 | source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282" | 166 | source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3" |
167 | dependencies = [ | 167 | dependencies = [ |
168 | "chalk-derive", | 168 | "chalk-derive", |
169 | "chalk-engine", | 169 | "chalk-engine", |
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 65db6d1b0..5fc0ec5e3 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml | |||
@@ -27,9 +27,9 @@ test_utils = { path = "../test_utils" } | |||
27 | 27 | ||
28 | scoped-tls = "1" | 28 | scoped-tls = "1" |
29 | 29 | ||
30 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "2c072cc830d04af5f10b390e6643327f85108282" } | 30 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" } |
31 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "2c072cc830d04af5f10b390e6643327f85108282" } | 31 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" } |
32 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "2c072cc830d04af5f10b390e6643327f85108282" } | 32 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" } |
33 | 33 | ||
34 | [dev-dependencies] | 34 | [dev-dependencies] |
35 | insta = "0.16.0" | 35 | insta = "0.16.0" |
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 1ccb7c3b4..5870618a0 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -182,7 +182,10 @@ impl chalk_ir::interner::Interner for Interner { | |||
182 | Arc::new(goal) | 182 | Arc::new(goal) |
183 | } | 183 | } |
184 | 184 | ||
185 | fn intern_goals(&self, data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals { | 185 | fn intern_goals<E>( |
186 | &self, | ||
187 | data: impl IntoIterator<Item = Result<Goal<Self>, E>>, | ||
188 | ) -> Result<Self::InternedGoals, E> { | ||
186 | data.into_iter().collect() | 189 | data.into_iter().collect() |
187 | } | 190 | } |
188 | 191 | ||
@@ -222,10 +225,10 @@ impl chalk_ir::interner::Interner for Interner { | |||
222 | clause | 225 | clause |
223 | } | 226 | } |
224 | 227 | ||
225 | fn intern_program_clauses( | 228 | fn intern_program_clauses<E>( |
226 | &self, | 229 | &self, |
227 | data: impl IntoIterator<Item = chalk_ir::ProgramClause<Self>>, | 230 | data: impl IntoIterator<Item = Result<chalk_ir::ProgramClause<Self>, E>>, |
228 | ) -> Arc<[chalk_ir::ProgramClause<Self>]> { | 231 | ) -> Result<Arc<[chalk_ir::ProgramClause<Self>]>, E> { |
229 | data.into_iter().collect() | 232 | data.into_iter().collect() |
230 | } | 233 | } |
231 | 234 | ||
@@ -236,10 +239,10 @@ impl chalk_ir::interner::Interner for Interner { | |||
236 | &clauses | 239 | &clauses |
237 | } | 240 | } |
238 | 241 | ||
239 | fn intern_quantified_where_clauses( | 242 | fn intern_quantified_where_clauses<E>( |
240 | &self, | 243 | &self, |
241 | data: impl IntoIterator<Item = chalk_ir::QuantifiedWhereClause<Self>>, | 244 | data: impl IntoIterator<Item = Result<chalk_ir::QuantifiedWhereClause<Self>, E>>, |
242 | ) -> Self::InternedQuantifiedWhereClauses { | 245 | ) -> Result<Self::InternedQuantifiedWhereClauses, E> { |
243 | data.into_iter().collect() | 246 | data.into_iter().collect() |
244 | } | 247 | } |
245 | 248 | ||
@@ -250,10 +253,10 @@ impl chalk_ir::interner::Interner for Interner { | |||
250 | clauses | 253 | clauses |
251 | } | 254 | } |
252 | 255 | ||
253 | fn intern_parameter_kinds( | 256 | fn intern_parameter_kinds<E>( |
254 | &self, | 257 | &self, |
255 | data: impl IntoIterator<Item = chalk_ir::ParameterKind<()>>, | 258 | data: impl IntoIterator<Item = Result<chalk_ir::ParameterKind<()>, E>>, |
256 | ) -> Self::InternedParameterKinds { | 259 | ) -> Result<Self::InternedParameterKinds, E> { |
257 | data.into_iter().collect() | 260 | data.into_iter().collect() |
258 | } | 261 | } |
259 | 262 | ||
@@ -264,10 +267,10 @@ impl chalk_ir::interner::Interner for Interner { | |||
264 | ¶meter_kinds | 267 | ¶meter_kinds |
265 | } | 268 | } |
266 | 269 | ||
267 | fn intern_canonical_var_kinds( | 270 | fn intern_canonical_var_kinds<E>( |
268 | &self, | 271 | &self, |
269 | data: impl IntoIterator<Item = chalk_ir::ParameterKind<UniverseIndex>>, | 272 | data: impl IntoIterator<Item = Result<chalk_ir::ParameterKind<UniverseIndex>, E>>, |
270 | ) -> Self::InternedCanonicalVarKinds { | 273 | ) -> Result<Self::InternedCanonicalVarKinds, E> { |
271 | data.into_iter().collect() | 274 | data.into_iter().collect() |
272 | } | 275 | } |
273 | 276 | ||
@@ -460,6 +463,14 @@ impl ToChalk for TypeCtor { | |||
460 | TypeName::Struct(struct_id) => db.lookup_intern_type_ctor(struct_id.into()), | 463 | TypeName::Struct(struct_id) => db.lookup_intern_type_ctor(struct_id.into()), |
461 | TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)), | 464 | TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)), |
462 | TypeName::OpaqueType(_) => unreachable!(), | 465 | TypeName::OpaqueType(_) => unreachable!(), |
466 | |||
467 | TypeName::Scalar(_) => unreachable!(), | ||
468 | TypeName::Tuple(_) => unreachable!(), | ||
469 | TypeName::Raw(_) => unreachable!(), | ||
470 | TypeName::Slice => unreachable!(), | ||
471 | TypeName::Ref(_) => unreachable!(), | ||
472 | TypeName::Str => unreachable!(), | ||
473 | |||
463 | TypeName::Error => { | 474 | TypeName::Error => { |
464 | // this should not be reached, since we don't represent TypeName::Error with TypeCtor | 475 | // this should not be reached, since we don't represent TypeName::Error with TypeCtor |
465 | unreachable!() | 476 | unreachable!() |
@@ -862,12 +873,6 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
862 | // We don't do coherence checking (yet) | 873 | // We don't do coherence checking (yet) |
863 | unimplemented!() | 874 | unimplemented!() |
864 | } | 875 | } |
865 | fn as_struct_id(&self, id: &TypeName<Interner>) -> Option<StructId> { | ||
866 | match id { | ||
867 | TypeName::Struct(struct_id) => Some(*struct_id), | ||
868 | _ => None, | ||
869 | } | ||
870 | } | ||
871 | fn interner(&self) -> &Interner { | 876 | fn interner(&self) -> &Interner { |
872 | &Interner | 877 | &Interner |
873 | } | 878 | } |
@@ -892,6 +897,20 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
892 | ) -> Arc<chalk_rust_ir::OpaqueTyDatum<Interner>> { | 897 | ) -> Arc<chalk_rust_ir::OpaqueTyDatum<Interner>> { |
893 | unimplemented!() | 898 | unimplemented!() |
894 | } | 899 | } |
900 | |||
901 | fn force_impl_for( | ||
902 | &self, | ||
903 | _well_known: chalk_rust_ir::WellKnownTrait, | ||
904 | _ty: &chalk_ir::TyData<Interner>, | ||
905 | ) -> Option<bool> { | ||
906 | // this method is mostly for rustc | ||
907 | None | ||
908 | } | ||
909 | |||
910 | fn is_object_safe(&self, _trait_id: chalk_ir::TraitId<Interner>) -> bool { | ||
911 | // FIXME: implement actual object safety | ||
912 | true | ||
913 | } | ||
895 | } | 914 | } |
896 | 915 | ||
897 | pub(crate) fn program_clauses_for_chalk_env_query( | 916 | pub(crate) fn program_clauses_for_chalk_env_query( |