diff options
Diffstat (limited to 'crates/hir_def/src/find_path.rs')
-rw-r--r-- | crates/hir_def/src/find_path.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_def/src/find_path.rs b/crates/hir_def/src/find_path.rs index db2d125ae..c01b6daf2 100644 --- a/crates/hir_def/src/find_path.rs +++ b/crates/hir_def/src/find_path.rs | |||
@@ -110,7 +110,7 @@ fn find_path_inner( | |||
110 | // Base cases: | 110 | // Base cases: |
111 | 111 | ||
112 | // - if the item is already in scope, return the name under which it is | 112 | // - if the item is already in scope, return the name under which it is |
113 | let def_map = db.crate_def_map(from.krate); | 113 | let def_map = from.def_map(db); |
114 | let from_scope: &crate::item_scope::ItemScope = &def_map[from.local_id].scope; | 114 | let from_scope: &crate::item_scope::ItemScope = &def_map[from.local_id].scope; |
115 | let scope_name = | 115 | let scope_name = |
116 | if let Some((name, _)) = from_scope.name_of(item) { Some(name.clone()) } else { None }; | 116 | if let Some((name, _)) = from_scope.name_of(item) { Some(name.clone()) } else { None }; |
@@ -145,7 +145,7 @@ fn find_path_inner( | |||
145 | 145 | ||
146 | // - if the item is in the prelude, return the name from there | 146 | // - if the item is in the prelude, return the name from there |
147 | if let Some(prelude_module) = def_map.prelude() { | 147 | if let Some(prelude_module) = def_map.prelude() { |
148 | let prelude_def_map = db.crate_def_map(prelude_module.krate); | 148 | let prelude_def_map = prelude_module.def_map(db); |
149 | let prelude_scope: &crate::item_scope::ItemScope = | 149 | let prelude_scope: &crate::item_scope::ItemScope = |
150 | &prelude_def_map[prelude_module.local_id].scope; | 150 | &prelude_def_map[prelude_module.local_id].scope; |
151 | if let Some((name, vis)) = prelude_scope.name_of(item) { | 151 | if let Some((name, vis)) = prelude_scope.name_of(item) { |
@@ -283,7 +283,7 @@ fn find_local_import_locations( | |||
283 | // above `from` with any visibility. That means we do not need to descend into private siblings | 283 | // above `from` with any visibility. That means we do not need to descend into private siblings |
284 | // of `from` (and similar). | 284 | // of `from` (and similar). |
285 | 285 | ||
286 | let def_map = db.crate_def_map(from.krate); | 286 | let def_map = from.def_map(db); |
287 | 287 | ||
288 | // Compute the initial worklist. We start with all direct child modules of `from` as well as all | 288 | // Compute the initial worklist. We start with all direct child modules of `from` as well as all |
289 | // of its (recursive) parent modules. | 289 | // of its (recursive) parent modules. |
@@ -312,7 +312,7 @@ fn find_local_import_locations( | |||
312 | &def_map[module.local_id] | 312 | &def_map[module.local_id] |
313 | } else { | 313 | } else { |
314 | // The crate might reexport a module defined in another crate. | 314 | // The crate might reexport a module defined in another crate. |
315 | ext_def_map = db.crate_def_map(module.krate); | 315 | ext_def_map = module.def_map(db); |
316 | &ext_def_map[module.local_id] | 316 | &ext_def_map[module.local_id] |
317 | }; | 317 | }; |
318 | 318 | ||
@@ -375,7 +375,7 @@ mod tests { | |||
375 | parsed_path_file.syntax_node().descendants().find_map(syntax::ast::Path::cast).unwrap(); | 375 | parsed_path_file.syntax_node().descendants().find_map(syntax::ast::Path::cast).unwrap(); |
376 | let mod_path = ModPath::from_src(ast_path, &Hygiene::new_unhygienic()).unwrap(); | 376 | let mod_path = ModPath::from_src(ast_path, &Hygiene::new_unhygienic()).unwrap(); |
377 | 377 | ||
378 | let crate_def_map = db.crate_def_map(module.krate); | 378 | let crate_def_map = module.def_map(&db); |
379 | let resolved = crate_def_map | 379 | let resolved = crate_def_map |
380 | .resolve_path( | 380 | .resolve_path( |
381 | &db, | 381 | &db, |