diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-13 15:09:41 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-13 15:09:41 +0100 |
commit | 3d8df2aef87bca7ec3f0994d799462f08d1ad449 (patch) | |
tree | a43b94510193f1f58ec7bfc39814ae58f673ceca /crates/hir/src/lib.rs | |
parent | e6fa9b016fab4bf38f4e2a798fcabcc13b58e9ab (diff) | |
parent | fa9ed4e0ce633e51d1411951bf044719e6837457 (diff) |
Merge #9248
9248: internal: refactor unresolved macro call diagnostic r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r-- | crates/hir/src/lib.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index f7883c469..0a9414013 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -498,7 +498,10 @@ impl Module { | |||
498 | let import = &item_tree[id.value]; | 498 | let import = &item_tree[id.value]; |
499 | 499 | ||
500 | let use_tree = import.use_tree_to_ast(db.upcast(), file_id, *index); | 500 | let use_tree = import.use_tree_to_ast(db.upcast(), file_id, *index); |
501 | sink.push(UnresolvedImport { file: file_id, node: AstPtr::new(&use_tree) }); | 501 | acc.push( |
502 | UnresolvedImport { decl: InFile::new(file_id, AstPtr::new(&use_tree)) } | ||
503 | .into(), | ||
504 | ); | ||
502 | } | 505 | } |
503 | 506 | ||
504 | DefDiagnosticKind::UnconfiguredCode { ast, cfg, opts } => { | 507 | DefDiagnosticKind::UnconfiguredCode { ast, cfg, opts } => { |
@@ -577,11 +580,13 @@ impl Module { | |||
577 | 580 | ||
578 | DefDiagnosticKind::UnresolvedMacroCall { ast, path } => { | 581 | DefDiagnosticKind::UnresolvedMacroCall { ast, path } => { |
579 | let node = ast.to_node(db.upcast()); | 582 | let node = ast.to_node(db.upcast()); |
580 | sink.push(UnresolvedMacroCall { | 583 | acc.push( |
581 | file: ast.file_id, | 584 | UnresolvedMacroCall { |
582 | node: AstPtr::new(&node), | 585 | macro_call: InFile::new(ast.file_id, AstPtr::new(&node)), |
583 | path: path.clone(), | 586 | path: path.clone(), |
584 | }); | 587 | } |
588 | .into(), | ||
589 | ); | ||
585 | } | 590 | } |
586 | 591 | ||
587 | DefDiagnosticKind::MacroError { ast, message } => { | 592 | DefDiagnosticKind::MacroError { ast, message } => { |
@@ -1057,13 +1062,9 @@ impl Function { | |||
1057 | precise_location: None, | 1062 | precise_location: None, |
1058 | macro_name: None, | 1063 | macro_name: None, |
1059 | }), | 1064 | }), |
1060 | BodyDiagnostic::UnresolvedMacroCall { node, path } => { | 1065 | BodyDiagnostic::UnresolvedMacroCall { node, path } => acc.push( |
1061 | sink.push(UnresolvedMacroCall { | 1066 | UnresolvedMacroCall { macro_call: node.clone(), path: path.clone() }.into(), |
1062 | file: node.file_id, | 1067 | ), |
1063 | node: node.value.clone(), | ||
1064 | path: path.clone(), | ||
1065 | }) | ||
1066 | } | ||
1067 | } | 1068 | } |
1068 | } | 1069 | } |
1069 | 1070 | ||