diff options
author | Jonas Schievink <[email protected]> | 2021-05-26 00:01:58 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-05-26 00:01:58 +0100 |
commit | b52df9187730abbcd9cbb132f7d184c74b9a3b7f (patch) | |
tree | 06cf9ab8dcd938db5390b7da40f7e9a6db262d0d /crates/hir | |
parent | 5587d0a3e3599063a8993e9a44a7628abbabae8b (diff) |
Stop expanding UseTrees during ItemTree lowering
Diffstat (limited to 'crates/hir')
-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 } => { |