From d89996fd5bf9ca8111f6a45ff59a0f43b3b9836a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 10 Dec 2019 13:52:04 +0100 Subject: Build correct SourceAnalyzer for traits --- crates/ra_hir/src/source_binder.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'crates/ra_hir/src') 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>) - let src = node.with_value(it); Some(ImplBlock::from_source(db, src)?.id.resolver(db)) }, + ast::TraitDef(it) => { + let src = node.with_value(it); + Some(Trait::from_source(db, src)?.id.resolver(db)) + }, _ => match node.value.kind() { FN_DEF | CONST_DEF | STATIC_DEF => { let def = def_with_body_from_child_node(db, node)?; @@ -411,20 +415,6 @@ impl SourceAnalyzer { ) } - // pub fn autoderef<'a>( - // &'a self, - // db: &'a impl HirDatabase, - // ty: Ty, - // ) -> impl Iterator + 'a { - // // There should be no inference vars in types passed here - // // FIXME check that? - // let canonical = Canonical { value: ty, num_vars: 0 }; - // let krate = self.resolver.krate(); - // let environment = TraitEnvironment::lower(db, &self.resolver); - // let ty = crate::ty::InEnvironment { value: canonical, environment }; - // crate::ty::autoderef(db, krate, ty).map(|canonical| canonical.value) - // } - /// Checks that particular type `ty` implements `std::future::Future`. /// This function is used in `.await` syntax completion. pub fn impls_future(&self, db: &impl HirDatabase, ty: Type) -> bool { -- cgit v1.2.3