aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-10 12:53:35 +0000
committerGitHub <[email protected]>2019-12-10 12:53:35 +0000
commitee904594af174866cfa10474fd8fd3f23580b6af (patch)
tree7bf37b1a6259cd73e9a69458d93ca35b8c18ac6e /crates
parentbaae1b3d0049e804e76d39cde82ebec0ef0599bb (diff)
parentd89996fd5bf9ca8111f6a45ff59a0f43b3b9836a (diff)
Merge #2519
2519: Build correct SourceAnalyzer for traits r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/source_binder.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 44d185003..d3cc5c423 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -62,6 +62,10 @@ fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -
62 let src = node.with_value(it); 62 let src = node.with_value(it);
63 Some(ImplBlock::from_source(db, src)?.id.resolver(db)) 63 Some(ImplBlock::from_source(db, src)?.id.resolver(db))
64 }, 64 },
65 ast::TraitDef(it) => {
66 let src = node.with_value(it);
67 Some(Trait::from_source(db, src)?.id.resolver(db))
68 },
65 _ => match node.value.kind() { 69 _ => match node.value.kind() {
66 FN_DEF | CONST_DEF | STATIC_DEF => { 70 FN_DEF | CONST_DEF | STATIC_DEF => {
67 let def = def_with_body_from_child_node(db, node)?; 71 let def = def_with_body_from_child_node(db, node)?;
@@ -411,20 +415,6 @@ impl SourceAnalyzer {
411 ) 415 )
412 } 416 }
413 417
414 // pub fn autoderef<'a>(
415 // &'a self,
416 // db: &'a impl HirDatabase,
417 // ty: Ty,
418 // ) -> impl Iterator<Item = Ty> + 'a {
419 // // There should be no inference vars in types passed here
420 // // FIXME check that?
421 // let canonical = Canonical { value: ty, num_vars: 0 };
422 // let krate = self.resolver.krate();
423 // let environment = TraitEnvironment::lower(db, &self.resolver);
424 // let ty = crate::ty::InEnvironment { value: canonical, environment };
425 // crate::ty::autoderef(db, krate, ty).map(|canonical| canonical.value)
426 // }
427
428 /// Checks that particular type `ty` implements `std::future::Future`. 418 /// Checks that particular type `ty` implements `std::future::Future`.
429 /// This function is used in `.await` syntax completion. 419 /// This function is used in `.await` syntax completion.
430 pub fn impls_future(&self, db: &impl HirDatabase, ty: Type) -> bool { 420 pub fn impls_future(&self, db: &impl HirDatabase, ty: Type) -> bool {