aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-15 16:15:01 +0000
committerAleksey Kladov <[email protected]>2019-01-15 16:15:01 +0000
commit490112dea10d476e9b5829499bc6670f03f7d138 (patch)
tree2c02cf513feeb85054e68a04f28c16e516c54653 /crates
parent18e9a710cd2f2ced84fde19e88d0b967dcb5939e (diff)
remove Cancelable from nameres
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/code_model_api.rs4
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs33
-rw-r--r--crates/ra_hir/src/db.rs2
-rw-r--r--crates/ra_hir/src/nameres.rs42
-rw-r--r--crates/ra_hir/src/nameres/tests.rs12
-rw-r--r--crates/ra_hir/src/query_definitions.rs11
-rw-r--r--crates/ra_hir/src/ty.rs6
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs4
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs2
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs2
10 files changed, 52 insertions, 66 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 4d7925ac4..7ccd29e2f 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -134,11 +134,11 @@ impl Module {
134 } 134 }
135 135
136 /// Returns a `ModuleScope`: a set of items, visible in this module. 136 /// Returns a `ModuleScope`: a set of items, visible in this module.
137 pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { 137 pub fn scope(&self, db: &impl HirDatabase) -> ModuleScope {
138 self.scope_impl(db) 138 self.scope_impl(db)
139 } 139 }
140 140
141 pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> { 141 pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> PerNs<DefId> {
142 self.resolve_path_impl(db, path) 142 self.resolve_path_impl(db, path)
143 } 143 }
144 144
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 331b0500e..04301ae53 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -114,18 +114,13 @@ impl Module {
114 } 114 }
115 115
116 /// Returns a `ModuleScope`: a set of items, visible in this module. 116 /// Returns a `ModuleScope`: a set of items, visible in this module.
117 pub fn scope_impl(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { 117 pub fn scope_impl(&self, db: &impl HirDatabase) -> ModuleScope {
118 let loc = self.def_id.loc(db); 118 let loc = self.def_id.loc(db);
119 let item_map = db.item_map(loc.source_root_id)?; 119 let item_map = db.item_map(loc.source_root_id);
120 let res = item_map.per_module[&loc.module_id].clone(); 120 item_map.per_module[&loc.module_id].clone()
121 Ok(res)
122 } 121 }
123 122
124 pub fn resolve_path_impl( 123 pub fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs<DefId> {
125 &self,
126 db: &impl HirDatabase,
127 path: &Path,
128 ) -> Cancelable<PerNs<DefId>> {
129 let mut curr_per_ns = PerNs::types( 124 let mut curr_per_ns = PerNs::types(
130 match path.kind { 125 match path.kind {
131 PathKind::Crate => self.crate_root(db), 126 PathKind::Crate => self.crate_root(db),
@@ -134,7 +129,7 @@ impl Module {
134 if let Some(p) = self.parent(db) { 129 if let Some(p) = self.parent(db) {
135 p 130 p
136 } else { 131 } else {
137 return Ok(PerNs::none()); 132 return PerNs::none();
138 } 133 }
139 } 134 }
140 } 135 }
@@ -146,7 +141,7 @@ impl Module {
146 let curr = if let Some(r) = curr_per_ns.as_ref().take_types() { 141 let curr = if let Some(r) = curr_per_ns.as_ref().take_types() {
147 r 142 r
148 } else { 143 } else {
149 return Ok(PerNs::none()); 144 return PerNs::none();
150 }; 145 };
151 let module = match curr.resolve(db) { 146 let module = match curr.resolve(db) {
152 Def::Module(it) => it, 147 Def::Module(it) => it,
@@ -157,28 +152,28 @@ impl Module {
157 e.variants(db).into_iter().find(|(n, _variant)| n == name); 152 e.variants(db).into_iter().find(|(n, _variant)| n == name);
158 153
159 if let Some((_n, variant)) = matching_variant { 154 if let Some((_n, variant)) = matching_variant {
160 return Ok(PerNs::both(variant.def_id(), e.def_id())); 155 return PerNs::both(variant.def_id(), e.def_id());
161 } else { 156 } else {
162 return Ok(PerNs::none()); 157 return PerNs::none();
163 } 158 }
164 } else if segments.len() == idx { 159 } else if segments.len() == idx {
165 // enum 160 // enum
166 return Ok(PerNs::types(e.def_id())); 161 return PerNs::types(e.def_id());
167 } else { 162 } else {
168 // malformed enum? 163 // malformed enum?
169 return Ok(PerNs::none()); 164 return PerNs::none();
170 } 165 }
171 } 166 }
172 _ => return Ok(PerNs::none()), 167 _ => return PerNs::none(),
173 }; 168 };
174 let scope = module.scope(db)?; 169 let scope = module.scope(db);
175 curr_per_ns = if let Some(r) = scope.get(&name) { 170 curr_per_ns = if let Some(r) = scope.get(&name) {
176 r.def_id 171 r.def_id
177 } else { 172 } else {
178 return Ok(PerNs::none()); 173 return PerNs::none();
179 }; 174 };
180 } 175 }
181 Ok(curr_per_ns) 176 curr_per_ns
182 } 177 }
183 178
184 pub fn problems_impl( 179 pub fn problems_impl(
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index d20c03f43..1466c3438 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -87,7 +87,7 @@ pub trait HirDatabase: SyntaxDatabase
87 use fn query_definitions::input_module_items; 87 use fn query_definitions::input_module_items;
88 } 88 }
89 89
90 fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> { 90 fn item_map(source_root_id: SourceRootId) -> Arc<ItemMap> {
91 type ItemMapQuery; 91 type ItemMapQuery;
92 use fn query_definitions::item_map; 92 use fn query_definitions::item_map;
93 } 93 }
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index e51cbe786..484f668d0 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -22,7 +22,7 @@ use ra_syntax::{
22 SyntaxKind::{self, *}, 22 SyntaxKind::{self, *},
23 ast::{self, AstNode} 23 ast::{self, AstNode}
24}; 24};
25use ra_db::{SourceRootId, Cancelable, FileId}; 25use ra_db::{SourceRootId, FileId};
26 26
27use crate::{ 27use crate::{
28 HirFileId, 28 HirFileId,
@@ -319,30 +319,26 @@ where
319 } 319 }
320 } 320 }
321 321
322 pub(crate) fn resolve(mut self) -> Cancelable<ItemMap> { 322 pub(crate) fn resolve(mut self) -> ItemMap {
323 for (&module_id, items) in self.input.iter() { 323 for (&module_id, items) in self.input.iter() {
324 self.populate_module(module_id, Arc::clone(items))?; 324 self.populate_module(module_id, Arc::clone(items));
325 } 325 }
326 326
327 loop { 327 loop {
328 let processed_imports_count = self.processed_imports.len(); 328 let processed_imports_count = self.processed_imports.len();
329 for &module_id in self.input.keys() { 329 for &module_id in self.input.keys() {
330 self.db.check_canceled(); 330 self.db.check_canceled();
331 self.resolve_imports(module_id)?; 331 self.resolve_imports(module_id);
332 } 332 }
333 if processed_imports_count == self.processed_imports.len() { 333 if processed_imports_count == self.processed_imports.len() {
334 // no new imports resolved 334 // no new imports resolved
335 break; 335 break;
336 } 336 }
337 } 337 }
338 Ok(self.result) 338 self.result
339 } 339 }
340 340
341 fn populate_module( 341 fn populate_module(&mut self, module_id: ModuleId, input: Arc<InputModuleItems>) {
342 &mut self,
343 module_id: ModuleId,
344 input: Arc<InputModuleItems>,
345 ) -> Cancelable<()> {
346 let mut module_items = ModuleScope::default(); 342 let mut module_items = ModuleScope::default();
347 343
348 // Populate extern crates prelude 344 // Populate extern crates prelude
@@ -415,7 +411,6 @@ where
415 } 411 }
416 412
417 self.result.per_module.insert(module_id, module_items); 413 self.result.per_module.insert(module_id, module_items);
418 Ok(())
419 } 414 }
420 415
421 fn add_module_item(&self, module_items: &mut ModuleScope, name: Name, def_id: PerNs<DefId>) { 416 fn add_module_item(&self, module_items: &mut ModuleScope, name: Name, def_id: PerNs<DefId>) {
@@ -426,24 +421,23 @@ where
426 module_items.items.insert(name, resolution); 421 module_items.items.insert(name, resolution);
427 } 422 }
428 423
429 fn resolve_imports(&mut self, module_id: ModuleId) -> Cancelable<()> { 424 fn resolve_imports(&mut self, module_id: ModuleId) {
430 for (i, import) in self.input[&module_id].imports.iter().enumerate() { 425 for (i, import) in self.input[&module_id].imports.iter().enumerate() {
431 if self.processed_imports.contains(&(module_id, i)) { 426 if self.processed_imports.contains(&(module_id, i)) {
432 // already done 427 // already done
433 continue; 428 continue;
434 } 429 }
435 if self.resolve_import(module_id, import)? { 430 if self.resolve_import(module_id, import) {
436 log::debug!("import {:?} resolved (or definite error)", import); 431 log::debug!("import {:?} resolved (or definite error)", import);
437 self.processed_imports.insert((module_id, i)); 432 self.processed_imports.insert((module_id, i));
438 } 433 }
439 } 434 }
440 Ok(())
441 } 435 }
442 436
443 fn resolve_import(&mut self, module_id: ModuleId, import: &Import) -> Cancelable<bool> { 437 fn resolve_import(&mut self, module_id: ModuleId, import: &Import) -> bool {
444 log::debug!("resolving import: {:?}", import); 438 log::debug!("resolving import: {:?}", import);
445 let ptr = match import.kind { 439 let ptr = match import.kind {
446 ImportKind::Glob => return Ok(false), 440 ImportKind::Glob => return false,
447 ImportKind::Named(ptr) => ptr, 441 ImportKind::Named(ptr) => ptr,
448 }; 442 };
449 443
@@ -455,7 +449,7 @@ where
455 None => { 449 None => {
456 // TODO: error 450 // TODO: error
457 log::debug!("super path in root module"); 451 log::debug!("super path in root module");
458 return Ok(true); // this can't suddenly resolve if we just resolve some other imports 452 return true; // this can't suddenly resolve if we just resolve some other imports
459 } 453 }
460 } 454 }
461 } 455 }
@@ -469,7 +463,7 @@ where
469 Some(res) if !res.def_id.is_none() => res.def_id, 463 Some(res) if !res.def_id.is_none() => res.def_id,
470 _ => { 464 _ => {
471 log::debug!("path segment {:?} not found", name); 465 log::debug!("path segment {:?} not found", name);
472 return Ok(false); 466 return false;
473 } 467 }
474 }; 468 };
475 469
@@ -481,7 +475,7 @@ where
481 "path segment {:?} resolved to value only, but is not last", 475 "path segment {:?} resolved to value only, but is not last",
482 name 476 name
483 ); 477 );
484 return Ok(false); 478 return false;
485 }; 479 };
486 curr = match type_def_id.loc(self.db) { 480 curr = match type_def_id.loc(self.db) {
487 DefLoc { 481 DefLoc {
@@ -499,7 +493,7 @@ where
499 kind: PathKind::Crate, 493 kind: PathKind::Crate,
500 }; 494 };
501 log::debug!("resolving {:?} in other source root", path); 495 log::debug!("resolving {:?} in other source root", path);
502 let def_id = module.resolve_path(self.db, &path)?; 496 let def_id = module.resolve_path(self.db, &path);
503 if !def_id.is_none() { 497 if !def_id.is_none() {
504 let name = path.segments.last().unwrap(); 498 let name = path.segments.last().unwrap();
505 self.update(module_id, |items| { 499 self.update(module_id, |items| {
@@ -515,10 +509,10 @@ where
515 import, 509 import,
516 def_id.map(|did| did.loc(self.db)) 510 def_id.map(|did| did.loc(self.db))
517 ); 511 );
518 return Ok(true); 512 return true;
519 } else { 513 } else {
520 log::debug!("rest of path did not resolve in other source root"); 514 log::debug!("rest of path did not resolve in other source root");
521 return Ok(true); 515 return true;
522 } 516 }
523 } 517 }
524 } 518 }
@@ -528,7 +522,7 @@ where
528 name, 522 name,
529 type_def_id.loc(self.db) 523 type_def_id.loc(self.db)
530 ); 524 );
531 return Ok(true); // this resolved to a non-module, so the path won't ever resolve 525 return true; // this resolved to a non-module, so the path won't ever resolve
532 } 526 }
533 } 527 }
534 } else { 528 } else {
@@ -547,7 +541,7 @@ where
547 }) 541 })
548 } 542 }
549 } 543 }
550 Ok(true) 544 true
551 } 545 }
552 546
553 fn update(&mut self, module_id: ModuleId, f: impl FnOnce(&mut ModuleScope)) { 547 fn update(&mut self, module_id: ModuleId, f: impl FnOnce(&mut ModuleScope)) {
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index ea8ab4c83..9a0474045 100644
--- a/crates/ra_hir/src/nameres/tests.rs
+++ b/crates/ra_hir/src/nameres/tests.rs
@@ -17,7 +17,7 @@ fn item_map(fixture: &str) -> (Arc<ItemMap>, ModuleId) {
17 let source_root = db.file_source_root(pos.file_id); 17 let source_root = db.file_source_root(pos.file_id);
18 let module = crate::source_binder::module_from_position(&db, pos).unwrap(); 18 let module = crate::source_binder::module_from_position(&db, pos).unwrap();
19 let module_id = module.def_id.loc(&db).module_id; 19 let module_id = module.def_id.loc(&db).module_id;
20 (db.item_map(source_root).unwrap(), module_id) 20 (db.item_map(source_root), module_id)
21} 21}
22 22
23fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { 23fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) {
@@ -242,7 +242,7 @@ fn item_map_across_crates() {
242 let source_root = db.file_source_root(main_id); 242 let source_root = db.file_source_root(main_id);
243 let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap(); 243 let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap();
244 let module_id = module.def_id.loc(&db).module_id; 244 let module_id = module.def_id.loc(&db).module_id;
245 let item_map = db.item_map(source_root).unwrap(); 245 let item_map = db.item_map(source_root);
246 246
247 check_module_item_map( 247 check_module_item_map(
248 &item_map, 248 &item_map,
@@ -294,7 +294,7 @@ fn import_across_source_roots() {
294 294
295 let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap(); 295 let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap();
296 let module_id = module.def_id.loc(&db).module_id; 296 let module_id = module.def_id.loc(&db).module_id;
297 let item_map = db.item_map(source_root).unwrap(); 297 let item_map = db.item_map(source_root);
298 298
299 check_module_item_map( 299 check_module_item_map(
300 &item_map, 300 &item_map,
@@ -337,7 +337,7 @@ fn reexport_across_crates() {
337 let source_root = db.file_source_root(main_id); 337 let source_root = db.file_source_root(main_id);
338 let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap(); 338 let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap();
339 let module_id = module.def_id.loc(&db).module_id; 339 let module_id = module.def_id.loc(&db).module_id;
340 let item_map = db.item_map(source_root).unwrap(); 340 let item_map = db.item_map(source_root);
341 341
342 check_module_item_map( 342 check_module_item_map(
343 &item_map, 343 &item_map,
@@ -354,7 +354,7 @@ fn check_item_map_is_not_recomputed(initial: &str, file_change: &str) {
354 let source_root = db.file_source_root(pos.file_id); 354 let source_root = db.file_source_root(pos.file_id);
355 { 355 {
356 let events = db.log_executed(|| { 356 let events = db.log_executed(|| {
357 db.item_map(source_root).unwrap(); 357 db.item_map(source_root);
358 }); 358 });
359 assert!(format!("{:?}", events).contains("item_map")) 359 assert!(format!("{:?}", events).contains("item_map"))
360 } 360 }
@@ -363,7 +363,7 @@ fn check_item_map_is_not_recomputed(initial: &str, file_change: &str) {
363 363
364 { 364 {
365 let events = db.log_executed(|| { 365 let events = db.log_executed(|| {
366 db.item_map(source_root).unwrap(); 366 db.item_map(source_root);
367 }); 367 });
368 assert!( 368 assert!(
369 !format!("{:?}", events).contains("item_map"), 369 !format!("{:?}", events).contains("item_map"),
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs
index 8f33ec707..24cb5c752 100644
--- a/crates/ra_hir/src/query_definitions.rs
+++ b/crates/ra_hir/src/query_definitions.rs
@@ -8,7 +8,7 @@ use ra_syntax::{
8 AstNode, SyntaxNode, TreeArc, 8 AstNode, SyntaxNode, TreeArc,
9 ast::{self, ModuleItemOwner} 9 ast::{self, ModuleItemOwner}
10}; 10};
11use ra_db::{SourceRootId, Cancelable,}; 11use ra_db::SourceRootId;
12 12
13use crate::{ 13use crate::{
14 SourceFileItems, SourceItemId, DefId, HirFileId, ModuleSource, 14 SourceFileItems, SourceItemId, DefId, HirFileId, ModuleSource,
@@ -93,10 +93,7 @@ pub(super) fn input_module_items(
93 Arc::new(res) 93 Arc::new(res)
94} 94}
95 95
96pub(super) fn item_map( 96pub(super) fn item_map(db: &impl HirDatabase, source_root: SourceRootId) -> Arc<ItemMap> {
97 db: &impl HirDatabase,
98 source_root: SourceRootId,
99) -> Cancelable<Arc<ItemMap>> {
100 let start = Instant::now(); 97 let start = Instant::now();
101 let module_tree = db.module_tree(source_root); 98 let module_tree = db.module_tree(source_root);
102 let input = module_tree 99 let input = module_tree
@@ -105,8 +102,8 @@ pub(super) fn item_map(
105 .collect::<FxHashMap<_, _>>(); 102 .collect::<FxHashMap<_, _>>();
106 103
107 let resolver = Resolver::new(db, &input, source_root, module_tree); 104 let resolver = Resolver::new(db, &input, source_root, module_tree);
108 let res = resolver.resolve()?; 105 let res = resolver.resolve();
109 let elapsed = start.elapsed(); 106 let elapsed = start.elapsed();
110 log::info!("item_map: {:?}", elapsed); 107 log::info!("item_map: {:?}", elapsed);
111 Ok(Arc::new(res)) 108 Arc::new(res)
112} 109}
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 54eece165..6df7820ea 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -349,7 +349,7 @@ impl Ty {
349 } 349 }
350 350
351 // Resolve in module (in type namespace) 351 // Resolve in module (in type namespace)
352 let resolved = if let Some(r) = module.resolve_path(db, path)?.take_types() { 352 let resolved = if let Some(r) = module.resolve_path(db, path).take_types() {
353 r 353 r
354 } else { 354 } else {
355 return Ok(Ty::Unknown); 355 return Ok(Ty::Unknown);
@@ -860,7 +860,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
860 }; 860 };
861 861
862 // resolve in module 862 // resolve in module
863 let resolved = ctry!(self.module.resolve_path(self.db, &path)?.take_values()); 863 let resolved = ctry!(self.module.resolve_path(self.db, &path).take_values());
864 let ty = self.db.type_for_def(resolved)?; 864 let ty = self.db.type_for_def(resolved)?;
865 let ty = self.insert_type_vars(ty); 865 let ty = self.insert_type_vars(ty);
866 Ok(Some(ty)) 866 Ok(Some(ty))
@@ -872,7 +872,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
872 } else { 872 } else {
873 return Ok((Ty::Unknown, None)); 873 return Ok((Ty::Unknown, None));
874 }; 874 };
875 let def_id = if let Some(def_id) = self.module.resolve_path(self.db, &path)?.take_types() { 875 let def_id = if let Some(def_id) = self.module.resolve_path(self.db, &path).take_types() {
876 def_id 876 def_id
877 } else { 877 } else {
878 return Ok((Ty::Unknown, None)); 878 return Ok((Ty::Unknown, None));
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index 207a509b3..42468681a 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -8,13 +8,13 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C
8 (Some(path), Some(module)) => (path.clone(), module), 8 (Some(path), Some(module)) => (path.clone(), module),
9 _ => return Ok(()), 9 _ => return Ok(()),
10 }; 10 };
11 let def_id = match module.resolve_path(ctx.db, &path)?.take_types() { 11 let def_id = match module.resolve_path(ctx.db, &path).take_types() {
12 Some(it) => it, 12 Some(it) => it,
13 None => return Ok(()), 13 None => return Ok(()),
14 }; 14 };
15 match def_id.resolve(ctx.db) { 15 match def_id.resolve(ctx.db) {
16 hir::Def::Module(module) => { 16 hir::Def::Module(module) => {
17 let module_scope = module.scope(ctx.db)?; 17 let module_scope = module.scope(ctx.db);
18 for (name, res) in module_scope.entries() { 18 for (name, res) in module_scope.entries() {
19 CompletionItem::new(CompletionKind::Reference, name.to_string()) 19 CompletionItem::new(CompletionKind::Reference, name.to_string())
20 .from_resolution(ctx, res) 20 .from_resolution(ctx, res)
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index fdb64895e..660c7d16e 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -19,7 +19,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) ->
19 complete_fn(acc, &scopes, ctx.offset); 19 complete_fn(acc, &scopes, ctx.offset);
20 } 20 }
21 21
22 let module_scope = module.scope(ctx.db)?; 22 let module_scope = module.scope(ctx.db);
23 let (file_id, _) = module.definition_source(ctx.db); 23 let (file_id, _) = module.definition_source(ctx.db);
24 module_scope 24 module_scope
25 .entries() 25 .entries()
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 5d522181b..cdd8e211d 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -85,7 +85,7 @@ pub(crate) fn reference_definition(
85 .find_map(ast::Path::cast) 85 .find_map(ast::Path::cast)
86 .and_then(hir::Path::from_ast) 86 .and_then(hir::Path::from_ast)
87 { 87 {
88 let resolved = module.resolve_path(db, &path)?; 88 let resolved = module.resolve_path(db, &path);
89 if let Some(def_id) = resolved.take_types().or(resolved.take_values()) { 89 if let Some(def_id) = resolved.take_types().or(resolved.take_values()) {
90 if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)) { 90 if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)) {
91 return Ok(Exact(target)); 91 return Ok(Exact(target));