diff options
author | Aleksey Kladov <[email protected]> | 2019-01-15 16:04:49 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-15 16:04:49 +0000 |
commit | 18e9a710cd2f2ced84fde19e88d0b967dcb5939e (patch) | |
tree | 8cca098650d989ea58e6bd4aafd44e5ff85fcee5 /crates/ra_hir/src | |
parent | 040a622c5277511b4835fa35b72c314bf080b8cc (diff) |
remove Cancelable from fn_scopes
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/db.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/ty.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 2 |
5 files changed, 9 insertions, 9 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 | ||
21 | pub(super) fn fn_scopes(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<FnScopes>> { | 21 | pub(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 | ||
27 | pub(super) fn file_items(db: &impl HirDatabase, file_id: HirFileId) -> Arc<SourceFileItems> { | 27 | pub(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) { |