aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index f13d43740..898b823c0 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -10,6 +10,7 @@ use std::sync::Arc;
10use hir_def::{ 10use hir_def::{
11 expr::{ExprId, PatId}, 11 expr::{ExprId, PatId},
12 path::known, 12 path::known,
13 DefWithBodyId,
13}; 14};
14use hir_expand::{name::AsName, AstId, MacroCallId, MacroCallLoc, MacroFileKind, Source}; 15use hir_expand::{name::AsName, AstId, MacroCallId, MacroCallLoc, MacroFileKind, Source};
15use ra_syntax::{ 16use ra_syntax::{
@@ -51,7 +52,9 @@ fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) -
51 }, 52 },
52 _ => match node.value.kind() { 53 _ => match node.value.kind() {
53 FN_DEF | CONST_DEF | STATIC_DEF => { 54 FN_DEF | CONST_DEF | STATIC_DEF => {
54 Some(def_with_body_from_child_node(db, node)?.resolver(db)) 55 let def = def_with_body_from_child_node(db, node)?;
56 let def = DefWithBodyId::from(def);
57 Some(def.resolver(db))
55 } 58 }
56 // FIXME add missing cases 59 // FIXME add missing cases
57 _ => None 60 _ => None
@@ -232,7 +235,7 @@ impl SourceAnalyzer {
232 ) -> Option<MacroDef> { 235 ) -> Option<MacroDef> {
233 // This must be a normal source file rather than macro file. 236 // This must be a normal source file rather than macro file.
234 let path = macro_call.path().and_then(Path::from_ast)?; 237 let path = macro_call.path().and_then(Path::from_ast)?;
235 self.resolver.resolve_path_as_macro(db, &path) 238 self.resolver.resolve_path_as_macro(db, &path).map(|it| it.into())
236 } 239 }
237 240
238 pub fn resolve_hir_path( 241 pub fn resolve_hir_path(
@@ -275,7 +278,9 @@ impl SourceAnalyzer {
275 .take_types() 278 .take_types()
276 .map(|it| PathResolution::Def(it.into())); 279 .map(|it| PathResolution::Def(it.into()));
277 types.or(values).or(items).or_else(|| { 280 types.or(values).or(items).or_else(|| {
278 self.resolver.resolve_path_as_macro(db, &path).map(|def| PathResolution::Macro(def)) 281 self.resolver
282 .resolve_path_as_macro(db, &path)
283 .map(|def| PathResolution::Macro(def.into()))
279 }) 284 })
280 } 285 }
281 286
@@ -420,7 +425,7 @@ impl SourceAnalyzer {
420 }; 425 };
421 426
422 let canonical_ty = crate::ty::Canonical { value: ty, num_vars: 0 }; 427 let canonical_ty = crate::ty::Canonical { value: ty, num_vars: 0 };
423 implements_trait(&canonical_ty, db, &self.resolver, krate, std_future_trait) 428 implements_trait(&canonical_ty, db, &self.resolver, krate.into(), std_future_trait)
424 } 429 }
425 430
426 pub fn expand( 431 pub fn expand(