aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-10 12:52:04 +0000
committerAleksey Kladov <[email protected]>2019-12-10 12:52:04 +0000
commitd89996fd5bf9ca8111f6a45ff59a0f43b3b9836a (patch)
tree7bf37b1a6259cd73e9a69458d93ca35b8c18ac6e /crates/ra_hir
parentbaae1b3d0049e804e76d39cde82ebec0ef0599bb (diff)
Build correct SourceAnalyzer for traits
Diffstat (limited to 'crates/ra_hir')
-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 {