diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-09 08:50:18 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-09 08:50:18 +0100 |
commit | f59cd1a4a0d6c369025a7014e838d25f91d478e4 (patch) | |
tree | 2c4b9dc868a87507ed63e9dc46530cc60f38ae64 /crates/ra_hir/src/db.rs | |
parent | 35f28c538a9b9f461bb4db1a78d02e9f02a3d296 (diff) | |
parent | 9afbf2dff43dee3227358f10162d4c77d192ce7a (diff) |
Merge #1515
1515: Trait environment r=matklad a=flodiebold
This adds the environment, i.e. the set of `where` clauses in scope, when solving trait goals. That means that e.g. in
```rust
fn foo<T: SomeTrait>(t: T) {}
```
, we are able to complete methods of `SomeTrait` on the `t`. This affects the trait APIs quite a bit (since every method that needs to be able to solve for some trait needs to get this environment somehow), so I thought I'd do it rather sooner than later ;)
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r-- | crates/ra_hir/src/db.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 0e6e3fdb7..b0c027631 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -213,18 +213,11 @@ pub trait HirDatabase: DefDatabase + AstDatabase { | |||
213 | #[salsa::invoke(crate::ty::traits::chalk::impl_datum_query)] | 213 | #[salsa::invoke(crate::ty::traits::chalk::impl_datum_query)] |
214 | fn impl_datum(&self, krate: Crate, impl_id: chalk_ir::ImplId) -> Arc<chalk_rust_ir::ImplDatum>; | 214 | fn impl_datum(&self, krate: Crate, impl_id: chalk_ir::ImplId) -> Arc<chalk_rust_ir::ImplDatum>; |
215 | 215 | ||
216 | #[salsa::invoke(crate::ty::traits::implements_query)] | 216 | #[salsa::invoke(crate::ty::traits::solve_query)] |
217 | fn implements( | 217 | fn solve( |
218 | &self, | 218 | &self, |
219 | krate: Crate, | 219 | krate: Crate, |
220 | goal: crate::ty::Canonical<crate::ty::TraitRef>, | 220 | goal: crate::ty::Canonical<crate::ty::InEnvironment<crate::ty::Obligation>>, |
221 | ) -> Option<crate::ty::traits::Solution>; | ||
222 | |||
223 | #[salsa::invoke(crate::ty::traits::normalize_query)] | ||
224 | fn normalize( | ||
225 | &self, | ||
226 | krate: Crate, | ||
227 | goal: crate::ty::Canonical<crate::ty::ProjectionPredicate>, | ||
228 | ) -> Option<crate::ty::traits::Solution>; | 221 | ) -> Option<crate::ty::traits::Solution>; |
229 | } | 222 | } |
230 | 223 | ||