diff options
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r-- | crates/hir/src/lib.rs | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 1ecd2391b..01b2de515 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -472,27 +472,13 @@ impl Module { | |||
472 | }); | 472 | }); |
473 | } | 473 | } |
474 | 474 | ||
475 | DefDiagnosticKind::UnresolvedImport { ast, index } => { | 475 | DefDiagnosticKind::UnresolvedImport { id, index } => { |
476 | let use_item = ast.to_node(db.upcast()); | 476 | let file_id = id.file_id(); |
477 | let hygiene = Hygiene::new(db.upcast(), ast.file_id); | 477 | let item_tree = id.item_tree(db.upcast()); |
478 | let mut cur = 0; | 478 | let import = &item_tree[id.value]; |
479 | let mut tree = None; | ||
480 | ModPath::expand_use_item( | ||
481 | db.upcast(), | ||
482 | InFile::new(ast.file_id, use_item), | ||
483 | &hygiene, | ||
484 | |_mod_path, use_tree, _is_glob, _alias| { | ||
485 | if cur == *index { | ||
486 | tree = Some(use_tree.clone()); | ||
487 | } | ||
488 | |||
489 | cur += 1; | ||
490 | }, | ||
491 | ); | ||
492 | 479 | ||
493 | if let Some(tree) = tree { | 480 | let use_tree = import.use_tree_to_ast(db.upcast(), file_id, *index); |
494 | sink.push(UnresolvedImport { file: ast.file_id, node: AstPtr::new(&tree) }); | 481 | sink.push(UnresolvedImport { file: file_id, node: AstPtr::new(&use_tree) }); |
495 | } | ||
496 | } | 482 | } |
497 | 483 | ||
498 | DefDiagnosticKind::UnconfiguredCode { ast, cfg, opts } => { | 484 | DefDiagnosticKind::UnconfiguredCode { ast, cfg, opts } => { |