aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/code_model_api.rs8
-rw-r--r--crates/ra_hir/src/db.rs2
-rw-r--r--crates/ra_hir/src/query_definitions.rs4
-rw-r--r--crates/ra_hir/src/ty.rs2
-rw-r--r--crates/ra_hir/src/ty/tests.rs2
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs2
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs2
-rw-r--r--crates/ra_ide_api/src/imp.rs4
8 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 87175476b..4d7925ac4 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -305,13 +305,13 @@ impl Function {
305 db.body_syntax_mapping(self.def_id) 305 db.body_syntax_mapping(self.def_id)
306 } 306 }
307 307
308 pub fn scopes(&self, db: &impl HirDatabase) -> Cancelable<ScopesWithSyntaxMapping> { 308 pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSyntaxMapping {
309 let scopes = db.fn_scopes(self.def_id)?; 309 let scopes = db.fn_scopes(self.def_id);
310 let syntax_mapping = db.body_syntax_mapping(self.def_id); 310 let syntax_mapping = db.body_syntax_mapping(self.def_id);
311 Ok(ScopesWithSyntaxMapping { 311 ScopesWithSyntaxMapping {
312 scopes, 312 scopes,
313 syntax_mapping, 313 syntax_mapping,
314 }) 314 }
315 } 315 }
316 316
317 pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> { 317 pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> {
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index c81b8f5f4..d20c03f43 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -32,7 +32,7 @@ pub trait HirDatabase: SyntaxDatabase
32 use fn crate::macros::expand_macro_invocation; 32 use fn crate::macros::expand_macro_invocation;
33 } 33 }
34 34
35 fn fn_scopes(def_id: DefId) -> Cancelable<Arc<FnScopes>> { 35 fn fn_scopes(def_id: DefId) -> Arc<FnScopes> {
36 type FnScopesQuery; 36 type FnScopesQuery;
37 use fn query_definitions::fn_scopes; 37 use fn query_definitions::fn_scopes;
38 } 38 }
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs
index 31086d1e1..8f33ec707 100644
--- a/crates/ra_hir/src/query_definitions.rs
+++ b/crates/ra_hir/src/query_definitions.rs
@@ -18,10 +18,10 @@ use crate::{
18 nameres::{InputModuleItems, ItemMap, Resolver}, 18 nameres::{InputModuleItems, ItemMap, Resolver},
19}; 19};
20 20
21pub(super) fn fn_scopes(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<FnScopes>> { 21pub(super) fn fn_scopes(db: &impl HirDatabase, def_id: DefId) -> Arc<FnScopes> {
22 let body = db.body_hir(def_id); 22 let body = db.body_hir(def_id);
23 let res = FnScopes::new(body); 23 let res = FnScopes::new(body);
24 Ok(Arc::new(res)) 24 Arc::new(res)
25} 25}
26 26
27pub(super) fn file_items(db: &impl HirDatabase, file_id: HirFileId) -> Arc<SourceFileItems> { 27pub(super) fn file_items(db: &impl HirDatabase, file_id: HirFileId) -> Arc<SourceFileItems> {
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 519660084..54eece165 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -1206,7 +1206,7 @@ pub fn infer(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<InferenceRe
1206 db.check_canceled(); 1206 db.check_canceled();
1207 let function = Function::new(def_id); // TODO: consts also need inference 1207 let function = Function::new(def_id); // TODO: consts also need inference
1208 let body = function.body(db); 1208 let body = function.body(db);
1209 let scopes = db.fn_scopes(def_id)?; 1209 let scopes = db.fn_scopes(def_id);
1210 let module = function.module(db)?; 1210 let module = function.module(db)?;
1211 let impl_block = function.impl_block(db)?; 1211 let impl_block = function.impl_block(db)?;
1212 let mut ctx = InferenceContext::new(db, body, scopes, module, impl_block); 1212 let mut ctx = InferenceContext::new(db, body, scopes, module, impl_block);
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index b81d91e80..b44ac9987 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -322,7 +322,7 @@ fn infer(content: &str) -> String {
322 { 322 {
323 let func = source_binder::function_from_source(&db, file_id, fn_def).unwrap(); 323 let func = source_binder::function_from_source(&db, file_id, fn_def).unwrap();
324 let inference_result = func.infer(&db).unwrap(); 324 let inference_result = func.infer(&db).unwrap();
325 let body_syntax_mapping = func.body_syntax_mapping(&db).unwrap(); 325 let body_syntax_mapping = func.body_syntax_mapping(&db);
326 let mut types = Vec::new(); 326 let mut types = Vec::new();
327 for (pat, ty) in inference_result.type_of_pat.iter() { 327 for (pat, ty) in inference_result.type_of_pat.iter() {
328 let syntax_ptr = match body_syntax_mapping.pat_syntax(pat) { 328 let syntax_ptr = match body_syntax_mapping.pat_syntax(pat) {
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index f422bb9a7..fdb64895e 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -15,7 +15,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) ->
15 None => return Ok(()), 15 None => return Ok(()),
16 }; 16 };
17 if let Some(function) = &ctx.function { 17 if let Some(function) = &ctx.function {
18 let scopes = function.scopes(ctx.db)?; 18 let scopes = function.scopes(ctx.db);
19 complete_fn(acc, &scopes, ctx.offset); 19 complete_fn(acc, &scopes, ctx.offset);
20 } 20 }
21 21
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 46fd6883f..5d522181b 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -50,7 +50,7 @@ pub(crate) fn reference_definition(
50 if let Some(function) = 50 if let Some(function) =
51 hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax()) 51 hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax())
52 { 52 {
53 let scope = function.scopes(db)?; 53 let scope = function.scopes(db);
54 // First try to resolve the symbol locally 54 // First try to resolve the symbol locally
55 if let Some(entry) = scope.resolve_local_name(name_ref) { 55 if let Some(entry) = scope.resolve_local_name(name_ref) {
56 let nav = NavigationTarget::from_scope_entry(file_id, &entry); 56 let nav = NavigationTarget::from_scope_entry(file_id, &entry);
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index 3ef11dfa1..8b2cd6e27 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/imp.rs
@@ -128,7 +128,7 @@ impl db::RootDatabase {
128 .collect::<Vec<_>>(); 128 .collect::<Vec<_>>();
129 ret.extend( 129 ret.extend(
130 descr 130 descr
131 .scopes(self)? 131 .scopes(self)
132 .find_all_refs(binding) 132 .find_all_refs(binding)
133 .into_iter() 133 .into_iter()
134 .map(|ref_desc| (position.file_id, ref_desc.range)), 134 .map(|ref_desc| (position.file_id, ref_desc.range)),
@@ -156,7 +156,7 @@ impl db::RootDatabase {
156 position.file_id, 156 position.file_id,
157 name_ref.syntax(), 157 name_ref.syntax(),
158 )); 158 ));
159 let scope = descr.scopes(db)?; 159 let scope = descr.scopes(db);
160 let resolved = ctry!(scope.resolve_local_name(name_ref)); 160 let resolved = ctry!(scope.resolve_local_name(name_ref));
161 let resolved = resolved.ptr().resolve(source_file); 161 let resolved = resolved.ptr().resolve(source_file);
162 let binding = ctry!(find_node_at_offset::<ast::BindPat>( 162 let binding = ctry!(find_node_at_offset::<ast::BindPat>(