diff options
author | Florian Diebold <[email protected]> | 2019-03-26 22:07:26 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-04-14 10:28:53 +0100 |
commit | 413c87f155ab6b389b1cc122b5739716acccb476 (patch) | |
tree | ece00ee4bb46d32ec2a3c4124a43e3634eacd007 /crates/ra_hir/src/ty/method_resolution.rs | |
parent | 23b876bc3b00c53ce24b8a99b4f4bf190fc6300e (diff) |
Get substs for trait refs in impl blocks
Diffstat (limited to 'crates/ra_hir/src/ty/method_resolution.rs')
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index bb23246a6..aac7d6384 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -72,9 +72,9 @@ impl CrateImplBlocks { | |||
72 | 72 | ||
73 | let target_ty = impl_block.target_ty(db); | 73 | let target_ty = impl_block.target_ty(db); |
74 | 74 | ||
75 | if let Some(tr) = impl_block.target_trait(db) { | 75 | if let Some(tr) = impl_block.target_trait_ref(db) { |
76 | self.impls_by_trait | 76 | self.impls_by_trait |
77 | .entry(tr) | 77 | .entry(tr.trait_) |
78 | .or_insert_with(Vec::new) | 78 | .or_insert_with(Vec::new) |
79 | .push((module.module_id, impl_id)); | 79 | .push((module.module_id, impl_id)); |
80 | } else { | 80 | } else { |
@@ -185,6 +185,8 @@ impl Ty { | |||
185 | // well (in fact, the 'implements' condition could just be considered a | 185 | // well (in fact, the 'implements' condition could just be considered a |
186 | // 'where Self: Trait' clause) | 186 | // 'where Self: Trait' clause) |
187 | candidates.retain(|(t, _m)| { | 187 | candidates.retain(|(t, _m)| { |
188 | // FIXME construct substs of the correct length for the trait | ||
189 | // - check in rustc whether it does anything smarter than putting variables for everything | ||
188 | let trait_ref = TraitRef { trait_: *t, substs: Substs::single(self.clone()) }; | 190 | let trait_ref = TraitRef { trait_: *t, substs: Substs::single(self.clone()) }; |
189 | db.implements(trait_ref) | 191 | db.implements(trait_ref) |
190 | }); | 192 | }); |